aboutsummaryrefslogtreecommitdiff
path: root/nexgb/auto_xf86dri.go
blob: 7407d24eaf82f4ca82622f113ade6ea49ef5e942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
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
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
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
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
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
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
package xgb

/*
	This file was generated by xf86dri.xml on May 6 2012 5:48:47pm EDT.
	This file is automatically generated. Edit at your peril!
*/

// Xf86driInit must be called before using the XFree86-DRI extension.
func (c *Conn) Xf86driInit() error {
	reply, err := c.QueryExtension(11, "XFree86-DRI").Reply()
	switch {
	case err != nil:
		return err
	case !reply.Present:
		return newError("No extension named XFree86-DRI could be found on on the server.")
	}

	c.extLock.Lock()
	c.extensions["XFree86-DRI"] = reply.MajorOpcode
	for evNum, fun := range newExtEventFuncs["XFree86-DRI"] {
		newEventFuncs[int(reply.FirstEvent)+evNum] = fun
	}
	c.extLock.Unlock()

	return nil
}

func init() {
	newExtEventFuncs["XFree86-DRI"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Int8'

// Skipping definition for base type 'Card16'

// Skipping definition for base type 'Char'

// Skipping definition for base type 'Card32'

// Skipping definition for base type 'Double'

// Skipping definition for base type 'Bool'

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'

// Skipping definition for base type 'Card8'

// Skipping definition for base type 'Int16'

// Skipping definition for base type 'Int32'

// Skipping definition for base type 'Void'

// Skipping definition for base type 'Byte'

// 'Xf86driDrmClipRect' struct definition
// Size: 8
type Xf86driDrmClipRect struct {
	X1 int16
	Y1 int16
	X2 int16
	X3 int16
}

// Struct read Xf86driDrmClipRect
func ReadXf86driDrmClipRect(buf []byte, v *Xf86driDrmClipRect) int {
	b := 0

	v.X1 = int16(Get16(buf[b:]))
	b += 2

	v.Y1 = int16(Get16(buf[b:]))
	b += 2

	v.X2 = int16(Get16(buf[b:]))
	b += 2

	v.X3 = int16(Get16(buf[b:]))
	b += 2

	return b
}

// Struct list read Xf86driDrmClipRect
func ReadXf86driDrmClipRectList(buf []byte, dest []Xf86driDrmClipRect) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Xf86driDrmClipRect{}
		b += ReadXf86driDrmClipRect(buf[b:], &dest[i])
	}
	return pad(b)
}

// Struct write Xf86driDrmClipRect
func (v Xf86driDrmClipRect) Bytes() []byte {
	buf := make([]byte, 8)
	b := 0

	Put16(buf[b:], uint16(v.X1))
	b += 2

	Put16(buf[b:], uint16(v.Y1))
	b += 2

	Put16(buf[b:], uint16(v.X2))
	b += 2

	Put16(buf[b:], uint16(v.X3))
	b += 2

	return buf
}

// Write struct list Xf86driDrmClipRect
func Xf86driDrmClipRectListBytes(buf []byte, list []Xf86driDrmClipRect) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += pad(len(structBytes))
	}
	return b
}

// Request Xf86driQueryVersion
// size: 4
type Xf86driQueryVersionCookie struct {
	*cookie
}

func (c *Conn) Xf86driQueryVersion() Xf86driQueryVersionCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driQueryVersionRequest(), cookie)
	return Xf86driQueryVersionCookie{cookie}
}

func (c *Conn) Xf86driQueryVersionUnchecked() Xf86driQueryVersionCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driQueryVersionRequest(), cookie)
	return Xf86driQueryVersionCookie{cookie}
}

// Request reply for Xf86driQueryVersion
// size: 16
type Xf86driQueryVersionReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	DriMajorVersion uint16
	DriMinorVersion uint16
	DriMinorPatch   uint32
}

// Waits and reads reply data from request Xf86driQueryVersion
func (cook Xf86driQueryVersionCookie) Reply() (*Xf86driQueryVersionReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driQueryVersionReply(buf), nil
}

// Read reply into structure from buffer for Xf86driQueryVersion
func xf86driQueryVersionReply(buf []byte) *Xf86driQueryVersionReply {
	v := new(Xf86driQueryVersionReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.DriMajorVersion = Get16(buf[b:])
	b += 2

	v.DriMinorVersion = Get16(buf[b:])
	b += 2

	v.DriMinorPatch = Get32(buf[b:])
	b += 4

	return v
}

func (cook Xf86driQueryVersionCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driQueryVersion
func (c *Conn) xf86driQueryVersionRequest() []byte {
	size := 4
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 0 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	return buf
}

// Request Xf86driQueryDirectRenderingCapable
// size: 8
type Xf86driQueryDirectRenderingCapableCookie struct {
	*cookie
}

func (c *Conn) Xf86driQueryDirectRenderingCapable(Screen uint32) Xf86driQueryDirectRenderingCapableCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driQueryDirectRenderingCapableRequest(Screen), cookie)
	return Xf86driQueryDirectRenderingCapableCookie{cookie}
}

func (c *Conn) Xf86driQueryDirectRenderingCapableUnchecked(Screen uint32) Xf86driQueryDirectRenderingCapableCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driQueryDirectRenderingCapableRequest(Screen), cookie)
	return Xf86driQueryDirectRenderingCapableCookie{cookie}
}

// Request reply for Xf86driQueryDirectRenderingCapable
// size: 9
type Xf86driQueryDirectRenderingCapableReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	IsCapable bool
}

// Waits and reads reply data from request Xf86driQueryDirectRenderingCapable
func (cook Xf86driQueryDirectRenderingCapableCookie) Reply() (*Xf86driQueryDirectRenderingCapableReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driQueryDirectRenderingCapableReply(buf), nil
}

// Read reply into structure from buffer for Xf86driQueryDirectRenderingCapable
func xf86driQueryDirectRenderingCapableReply(buf []byte) *Xf86driQueryDirectRenderingCapableReply {
	v := new(Xf86driQueryDirectRenderingCapableReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	if buf[b] == 1 {
		v.IsCapable = true
	} else {
		v.IsCapable = false
	}
	b += 1

	return v
}

func (cook Xf86driQueryDirectRenderingCapableCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driQueryDirectRenderingCapable
func (c *Conn) xf86driQueryDirectRenderingCapableRequest(Screen uint32) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 1 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	return buf
}

// Request Xf86driOpenConnection
// size: 8
type Xf86driOpenConnectionCookie struct {
	*cookie
}

func (c *Conn) Xf86driOpenConnection(Screen uint32) Xf86driOpenConnectionCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driOpenConnectionRequest(Screen), cookie)
	return Xf86driOpenConnectionCookie{cookie}
}

func (c *Conn) Xf86driOpenConnectionUnchecked(Screen uint32) Xf86driOpenConnectionCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driOpenConnectionRequest(Screen), cookie)
	return Xf86driOpenConnectionCookie{cookie}
}

// Request reply for Xf86driOpenConnection
// size: (32 + pad((int(BusIdLen) * 1)))
type Xf86driOpenConnectionReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	SareaHandleLow  uint32
	SareaHandleHigh uint32
	BusIdLen        uint32
	// padding: 12 bytes
	BusId string // size: pad((int(BusIdLen) * 1))
}

// Waits and reads reply data from request Xf86driOpenConnection
func (cook Xf86driOpenConnectionCookie) Reply() (*Xf86driOpenConnectionReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driOpenConnectionReply(buf), nil
}

// Read reply into structure from buffer for Xf86driOpenConnection
func xf86driOpenConnectionReply(buf []byte) *Xf86driOpenConnectionReply {
	v := new(Xf86driOpenConnectionReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.SareaHandleLow = Get32(buf[b:])
	b += 4

	v.SareaHandleHigh = Get32(buf[b:])
	b += 4

	v.BusIdLen = Get32(buf[b:])
	b += 4

	b += 12 // padding

	{
		byteString := make([]byte, v.BusIdLen)
		copy(byteString[:v.BusIdLen], buf[b:])
		v.BusId = string(byteString)
		b += pad(int(v.BusIdLen))
	}

	return v
}

func (cook Xf86driOpenConnectionCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driOpenConnection
func (c *Conn) xf86driOpenConnectionRequest(Screen uint32) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	return buf
}

// Request Xf86driCloseConnection
// size: 8
type Xf86driCloseConnectionCookie struct {
	*cookie
}

// Write request to wire for Xf86driCloseConnection
func (c *Conn) Xf86driCloseConnection(Screen uint32) Xf86driCloseConnectionCookie {
	cookie := c.newCookie(false, false)
	c.newRequest(c.xf86driCloseConnectionRequest(Screen), cookie)
	return Xf86driCloseConnectionCookie{cookie}
}

func (c *Conn) Xf86driCloseConnectionChecked(Screen uint32) Xf86driCloseConnectionCookie {
	cookie := c.newCookie(true, false)
	c.newRequest(c.xf86driCloseConnectionRequest(Screen), cookie)
	return Xf86driCloseConnectionCookie{cookie}
}

func (cook Xf86driCloseConnectionCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driCloseConnection
func (c *Conn) xf86driCloseConnectionRequest(Screen uint32) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	return buf
}

// Request Xf86driGetClientDriverName
// size: 8
type Xf86driGetClientDriverNameCookie struct {
	*cookie
}

func (c *Conn) Xf86driGetClientDriverName(Screen uint32) Xf86driGetClientDriverNameCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driGetClientDriverNameRequest(Screen), cookie)
	return Xf86driGetClientDriverNameCookie{cookie}
}

func (c *Conn) Xf86driGetClientDriverNameUnchecked(Screen uint32) Xf86driGetClientDriverNameCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driGetClientDriverNameRequest(Screen), cookie)
	return Xf86driGetClientDriverNameCookie{cookie}
}

// Request reply for Xf86driGetClientDriverName
// size: (32 + pad((int(ClientDriverNameLen) * 1)))
type Xf86driGetClientDriverNameReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	ClientDriverMajorVersion uint32
	ClientDriverMinorVersion uint32
	ClientDriverPatchVersion uint32
	ClientDriverNameLen      uint32
	// padding: 8 bytes
	ClientDriverName string // size: pad((int(ClientDriverNameLen) * 1))
}

// Waits and reads reply data from request Xf86driGetClientDriverName
func (cook Xf86driGetClientDriverNameCookie) Reply() (*Xf86driGetClientDriverNameReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driGetClientDriverNameReply(buf), nil
}

// Read reply into structure from buffer for Xf86driGetClientDriverName
func xf86driGetClientDriverNameReply(buf []byte) *Xf86driGetClientDriverNameReply {
	v := new(Xf86driGetClientDriverNameReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.ClientDriverMajorVersion = Get32(buf[b:])
	b += 4

	v.ClientDriverMinorVersion = Get32(buf[b:])
	b += 4

	v.ClientDriverPatchVersion = Get32(buf[b:])
	b += 4

	v.ClientDriverNameLen = Get32(buf[b:])
	b += 4

	b += 8 // padding

	{
		byteString := make([]byte, v.ClientDriverNameLen)
		copy(byteString[:v.ClientDriverNameLen], buf[b:])
		v.ClientDriverName = string(byteString)
		b += pad(int(v.ClientDriverNameLen))
	}

	return v
}

func (cook Xf86driGetClientDriverNameCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driGetClientDriverName
func (c *Conn) xf86driGetClientDriverNameRequest(Screen uint32) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	return buf
}

// Request Xf86driCreateContext
// size: 16
type Xf86driCreateContextCookie struct {
	*cookie
}

func (c *Conn) Xf86driCreateContext(Screen uint32, Visual uint32, Context uint32) Xf86driCreateContextCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driCreateContextRequest(Screen, Visual, Context), cookie)
	return Xf86driCreateContextCookie{cookie}
}

func (c *Conn) Xf86driCreateContextUnchecked(Screen uint32, Visual uint32, Context uint32) Xf86driCreateContextCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driCreateContextRequest(Screen, Visual, Context), cookie)
	return Xf86driCreateContextCookie{cookie}
}

// Request reply for Xf86driCreateContext
// size: 12
type Xf86driCreateContextReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	HwContext uint32
}

// Waits and reads reply data from request Xf86driCreateContext
func (cook Xf86driCreateContextCookie) Reply() (*Xf86driCreateContextReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driCreateContextReply(buf), nil
}

// Read reply into structure from buffer for Xf86driCreateContext
func xf86driCreateContextReply(buf []byte) *Xf86driCreateContextReply {
	v := new(Xf86driCreateContextReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.HwContext = Get32(buf[b:])
	b += 4

	return v
}

func (cook Xf86driCreateContextCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driCreateContext
func (c *Conn) xf86driCreateContextRequest(Screen uint32, Visual uint32, Context uint32) []byte {
	size := 16
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 5 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Visual)
	b += 4

	Put32(buf[b:], Context)
	b += 4

	return buf
}

// Request Xf86driDestroyContext
// size: 12
type Xf86driDestroyContextCookie struct {
	*cookie
}

// Write request to wire for Xf86driDestroyContext
func (c *Conn) Xf86driDestroyContext(Screen uint32, Context uint32) Xf86driDestroyContextCookie {
	cookie := c.newCookie(false, false)
	c.newRequest(c.xf86driDestroyContextRequest(Screen, Context), cookie)
	return Xf86driDestroyContextCookie{cookie}
}

func (c *Conn) Xf86driDestroyContextChecked(Screen uint32, Context uint32) Xf86driDestroyContextCookie {
	cookie := c.newCookie(true, false)
	c.newRequest(c.xf86driDestroyContextRequest(Screen, Context), cookie)
	return Xf86driDestroyContextCookie{cookie}
}

func (cook Xf86driDestroyContextCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driDestroyContext
func (c *Conn) xf86driDestroyContextRequest(Screen uint32, Context uint32) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Context)
	b += 4

	return buf
}

// Request Xf86driCreateDrawable
// size: 12
type Xf86driCreateDrawableCookie struct {
	*cookie
}

func (c *Conn) Xf86driCreateDrawable(Screen uint32, Drawable uint32) Xf86driCreateDrawableCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driCreateDrawableRequest(Screen, Drawable), cookie)
	return Xf86driCreateDrawableCookie{cookie}
}

func (c *Conn) Xf86driCreateDrawableUnchecked(Screen uint32, Drawable uint32) Xf86driCreateDrawableCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driCreateDrawableRequest(Screen, Drawable), cookie)
	return Xf86driCreateDrawableCookie{cookie}
}

// Request reply for Xf86driCreateDrawable
// size: 12
type Xf86driCreateDrawableReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	HwDrawableHandle uint32
}

// Waits and reads reply data from request Xf86driCreateDrawable
func (cook Xf86driCreateDrawableCookie) Reply() (*Xf86driCreateDrawableReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driCreateDrawableReply(buf), nil
}

// Read reply into structure from buffer for Xf86driCreateDrawable
func xf86driCreateDrawableReply(buf []byte) *Xf86driCreateDrawableReply {
	v := new(Xf86driCreateDrawableReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.HwDrawableHandle = Get32(buf[b:])
	b += 4

	return v
}

func (cook Xf86driCreateDrawableCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driCreateDrawable
func (c *Conn) xf86driCreateDrawableRequest(Screen uint32, Drawable uint32) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 7 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Drawable)
	b += 4

	return buf
}

// Request Xf86driDestroyDrawable
// size: 12
type Xf86driDestroyDrawableCookie struct {
	*cookie
}

// Write request to wire for Xf86driDestroyDrawable
func (c *Conn) Xf86driDestroyDrawable(Screen uint32, Drawable uint32) Xf86driDestroyDrawableCookie {
	cookie := c.newCookie(false, false)
	c.newRequest(c.xf86driDestroyDrawableRequest(Screen, Drawable), cookie)
	return Xf86driDestroyDrawableCookie{cookie}
}

func (c *Conn) Xf86driDestroyDrawableChecked(Screen uint32, Drawable uint32) Xf86driDestroyDrawableCookie {
	cookie := c.newCookie(true, false)
	c.newRequest(c.xf86driDestroyDrawableRequest(Screen, Drawable), cookie)
	return Xf86driDestroyDrawableCookie{cookie}
}

func (cook Xf86driDestroyDrawableCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driDestroyDrawable
func (c *Conn) xf86driDestroyDrawableRequest(Screen uint32, Drawable uint32) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 8 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Drawable)
	b += 4

	return buf
}

// Request Xf86driGetDrawableInfo
// size: 12
type Xf86driGetDrawableInfoCookie struct {
	*cookie
}

func (c *Conn) Xf86driGetDrawableInfo(Screen uint32, Drawable uint32) Xf86driGetDrawableInfoCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driGetDrawableInfoRequest(Screen, Drawable), cookie)
	return Xf86driGetDrawableInfoCookie{cookie}
}

func (c *Conn) Xf86driGetDrawableInfoUnchecked(Screen uint32, Drawable uint32) Xf86driGetDrawableInfoCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driGetDrawableInfoRequest(Screen, Drawable), cookie)
	return Xf86driGetDrawableInfoCookie{cookie}
}

// Request reply for Xf86driGetDrawableInfo
// size: ((36 + pad((int(NumClipRects) * 8))) + pad((int(NumBackClipRects) * 8)))
type Xf86driGetDrawableInfoReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	DrawableTableIndex uint32
	DrawableTableStamp uint32
	DrawableOriginX    int16
	DrawableOriginY    int16
	DrawableSizeW      int16
	DrawableSizeH      int16
	NumClipRects       uint32
	BackX              int16
	BackY              int16
	NumBackClipRects   uint32
	ClipRects          []Xf86driDrmClipRect // size: pad((int(NumClipRects) * 8))
	BackClipRects      []Xf86driDrmClipRect // size: pad((int(NumBackClipRects) * 8))
}

// Waits and reads reply data from request Xf86driGetDrawableInfo
func (cook Xf86driGetDrawableInfoCookie) Reply() (*Xf86driGetDrawableInfoReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driGetDrawableInfoReply(buf), nil
}

// Read reply into structure from buffer for Xf86driGetDrawableInfo
func xf86driGetDrawableInfoReply(buf []byte) *Xf86driGetDrawableInfoReply {
	v := new(Xf86driGetDrawableInfoReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.DrawableTableIndex = Get32(buf[b:])
	b += 4

	v.DrawableTableStamp = Get32(buf[b:])
	b += 4

	v.DrawableOriginX = int16(Get16(buf[b:]))
	b += 2

	v.DrawableOriginY = int16(Get16(buf[b:]))
	b += 2

	v.DrawableSizeW = int16(Get16(buf[b:]))
	b += 2

	v.DrawableSizeH = int16(Get16(buf[b:]))
	b += 2

	v.NumClipRects = Get32(buf[b:])
	b += 4

	v.BackX = int16(Get16(buf[b:]))
	b += 2

	v.BackY = int16(Get16(buf[b:]))
	b += 2

	v.NumBackClipRects = Get32(buf[b:])
	b += 4

	v.ClipRects = make([]Xf86driDrmClipRect, v.NumClipRects)
	b += ReadXf86driDrmClipRectList(buf[b:], v.ClipRects)

	v.BackClipRects = make([]Xf86driDrmClipRect, v.NumBackClipRects)
	b += ReadXf86driDrmClipRectList(buf[b:], v.BackClipRects)

	return v
}

func (cook Xf86driGetDrawableInfoCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driGetDrawableInfo
func (c *Conn) xf86driGetDrawableInfoRequest(Screen uint32, Drawable uint32) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 9 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Drawable)
	b += 4

	return buf
}

// Request Xf86driGetDeviceInfo
// size: 8
type Xf86driGetDeviceInfoCookie struct {
	*cookie
}

func (c *Conn) Xf86driGetDeviceInfo(Screen uint32) Xf86driGetDeviceInfoCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driGetDeviceInfoRequest(Screen), cookie)
	return Xf86driGetDeviceInfoCookie{cookie}
}

func (c *Conn) Xf86driGetDeviceInfoUnchecked(Screen uint32) Xf86driGetDeviceInfoCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driGetDeviceInfoRequest(Screen), cookie)
	return Xf86driGetDeviceInfoCookie{cookie}
}

// Request reply for Xf86driGetDeviceInfo
// size: (32 + pad((int(DevicePrivateSize) * 4)))
type Xf86driGetDeviceInfoReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	FramebufferHandleLow    uint32
	FramebufferHandleHigh   uint32
	FramebufferOriginOffset uint32
	FramebufferSize         uint32
	FramebufferStride       uint32
	DevicePrivateSize       uint32
	DevicePrivate           []uint32 // size: pad((int(DevicePrivateSize) * 4))
}

// Waits and reads reply data from request Xf86driGetDeviceInfo
func (cook Xf86driGetDeviceInfoCookie) Reply() (*Xf86driGetDeviceInfoReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driGetDeviceInfoReply(buf), nil
}

// Read reply into structure from buffer for Xf86driGetDeviceInfo
func xf86driGetDeviceInfoReply(buf []byte) *Xf86driGetDeviceInfoReply {
	v := new(Xf86driGetDeviceInfoReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.FramebufferHandleLow = Get32(buf[b:])
	b += 4

	v.FramebufferHandleHigh = Get32(buf[b:])
	b += 4

	v.FramebufferOriginOffset = Get32(buf[b:])
	b += 4

	v.FramebufferSize = Get32(buf[b:])
	b += 4

	v.FramebufferStride = Get32(buf[b:])
	b += 4

	v.DevicePrivateSize = Get32(buf[b:])
	b += 4

	v.DevicePrivate = make([]uint32, v.DevicePrivateSize)
	for i := 0; i < int(v.DevicePrivateSize); i++ {
		v.DevicePrivate[i] = Get32(buf[b:])
		b += 4
	}
	b = pad(b)

	return v
}

func (cook Xf86driGetDeviceInfoCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driGetDeviceInfo
func (c *Conn) xf86driGetDeviceInfoRequest(Screen uint32) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 10 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	return buf
}

// Request Xf86driAuthConnection
// size: 12
type Xf86driAuthConnectionCookie struct {
	*cookie
}

func (c *Conn) Xf86driAuthConnection(Screen uint32, Magic uint32) Xf86driAuthConnectionCookie {
	cookie := c.newCookie(true, true)
	c.newRequest(c.xf86driAuthConnectionRequest(Screen, Magic), cookie)
	return Xf86driAuthConnectionCookie{cookie}
}

func (c *Conn) Xf86driAuthConnectionUnchecked(Screen uint32, Magic uint32) Xf86driAuthConnectionCookie {
	cookie := c.newCookie(false, true)
	c.newRequest(c.xf86driAuthConnectionRequest(Screen, Magic), cookie)
	return Xf86driAuthConnectionCookie{cookie}
}

// Request reply for Xf86driAuthConnection
// size: 12
type Xf86driAuthConnectionReply struct {
	Sequence uint16
	Length   uint32
	// padding: 1 bytes
	Authenticated uint32
}

// Waits and reads reply data from request Xf86driAuthConnection
func (cook Xf86driAuthConnectionCookie) Reply() (*Xf86driAuthConnectionReply, error) {
	buf, err := cook.reply()
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}
	return xf86driAuthConnectionReply(buf), nil
}

// Read reply into structure from buffer for Xf86driAuthConnection
func xf86driAuthConnectionReply(buf []byte) *Xf86driAuthConnectionReply {
	v := new(Xf86driAuthConnectionReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = Get16(buf[b:])
	b += 2

	v.Length = Get32(buf[b:]) // 4-byte units
	b += 4

	v.Authenticated = Get32(buf[b:])
	b += 4

	return v
}

func (cook Xf86driAuthConnectionCookie) Check() error {
	return cook.check()
}

// Write request to wire for Xf86driAuthConnection
func (c *Conn) xf86driAuthConnectionRequest(Screen uint32, Magic uint32) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.extensions["XFREE86-DRI"]
	b += 1

	buf[b] = 11 // request opcode
	b += 1

	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	Put32(buf[b:], Screen)
	b += 4

	Put32(buf[b:], Magic)
	b += 4

	return buf
}