From 135cee57610cccd10009b264cce7fbcd5af367cb Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sun, 6 May 2012 03:06:48 -0400 Subject: auto-generated Go code ftw. ~65,000 lines. woooheee --- nexgb/auto_dri2.go | 1534 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1534 insertions(+) create mode 100644 nexgb/auto_dri2.go (limited to 'nexgb/auto_dri2.go') diff --git a/nexgb/auto_dri2.go b/nexgb/auto_dri2.go new file mode 100644 index 0000000..7797623 --- /dev/null +++ b/nexgb/auto_dri2.go @@ -0,0 +1,1534 @@ +package xgb + +/* + This file was generated by dri2.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// 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' + +// 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' + +const ( + Dri2AttachmentBufferFrontLeft = 0 + Dri2AttachmentBufferBackLeft = 1 + Dri2AttachmentBufferFrontRight = 2 + Dri2AttachmentBufferBackRight = 3 + Dri2AttachmentBufferDepth = 4 + Dri2AttachmentBufferStencil = 5 + Dri2AttachmentBufferAccum = 6 + Dri2AttachmentBufferFakeFrontLeft = 7 + Dri2AttachmentBufferFakeFrontRight = 8 + Dri2AttachmentBufferDepthStencil = 9 + Dri2AttachmentBufferHiz = 10 +) + +const ( + Dri2DriverTypeDri = 0 + Dri2DriverTypeVdpau = 1 +) + +const ( + Dri2EventTypeExchangeComplete = 1 + Dri2EventTypeBlitComplete = 2 + Dri2EventTypeFlipComplete = 3 +) + +// 'Dri2DRI2Buffer' struct definition +// Size: 20 +type Dri2DRI2Buffer struct { + Attachment uint32 + Name uint32 + Pitch uint32 + Cpp uint32 + Flags uint32 +} + +// Struct read Dri2DRI2Buffer +func ReadDri2DRI2Buffer(buf []byte, v *Dri2DRI2Buffer) int { + b := 0 + + v.Attachment = Get32(buf[b:]) + b += 4 + + v.Name = Get32(buf[b:]) + b += 4 + + v.Pitch = Get32(buf[b:]) + b += 4 + + v.Cpp = Get32(buf[b:]) + b += 4 + + v.Flags = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Dri2DRI2Buffer +func ReadDri2DRI2BufferList(buf []byte, dest []Dri2DRI2Buffer) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Dri2DRI2Buffer{} + b += ReadDri2DRI2Buffer(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Dri2DRI2Buffer +func (v Dri2DRI2Buffer) Bytes() []byte { + buf := make([]byte, 20) + b := 0 + + Put32(buf[b:], v.Attachment) + b += 4 + + Put32(buf[b:], v.Name) + b += 4 + + Put32(buf[b:], v.Pitch) + b += 4 + + Put32(buf[b:], v.Cpp) + b += 4 + + Put32(buf[b:], v.Flags) + b += 4 + + return buf +} + +// Write struct list Dri2DRI2Buffer +func Dri2DRI2BufferListBytes(buf []byte, list []Dri2DRI2Buffer) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'Dri2AttachFormat' struct definition +// Size: 8 +type Dri2AttachFormat struct { + Attachment uint32 + Format uint32 +} + +// Struct read Dri2AttachFormat +func ReadDri2AttachFormat(buf []byte, v *Dri2AttachFormat) int { + b := 0 + + v.Attachment = Get32(buf[b:]) + b += 4 + + v.Format = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Dri2AttachFormat +func ReadDri2AttachFormatList(buf []byte, dest []Dri2AttachFormat) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Dri2AttachFormat{} + b += ReadDri2AttachFormat(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Dri2AttachFormat +func (v Dri2AttachFormat) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], v.Attachment) + b += 4 + + Put32(buf[b:], v.Format) + b += 4 + + return buf +} + +// Write struct list Dri2AttachFormat +func Dri2AttachFormatListBytes(buf []byte, list []Dri2AttachFormat) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Event definition Dri2BufferSwapComplete (0) +// Size: 32 + +const Dri2BufferSwapComplete = 0 + +type Dri2BufferSwapCompleteEvent struct { + Sequence uint16 + // padding: 1 bytes + EventType uint16 + // padding: 2 bytes + Drawable Id + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + Sbc uint32 +} + +// Event read Dri2BufferSwapComplete +func NewDri2BufferSwapCompleteEvent(buf []byte) Event { + v := Dri2BufferSwapCompleteEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.EventType = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.Sbc = Get32(buf[b:]) + b += 4 + + return v +} + +// Event write Dri2BufferSwapComplete +func (v Dri2BufferSwapCompleteEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put16(buf[b:], v.EventType) + b += 2 + + b += 2 // padding + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put32(buf[b:], v.UstHi) + b += 4 + + Put32(buf[b:], v.UstLo) + b += 4 + + Put32(buf[b:], v.MscHi) + b += 4 + + Put32(buf[b:], v.MscLo) + b += 4 + + Put32(buf[b:], v.Sbc) + b += 4 + + return buf +} + +func (v Dri2BufferSwapCompleteEvent) ImplementsEvent() {} + +func (v Dri2BufferSwapCompleteEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v Dri2BufferSwapCompleteEvent) String() string { + fieldVals := make([]string, 0, 9) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("EventType: %d", v.EventType)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("UstHi: %d", v.UstHi)) + fieldVals = append(fieldVals, sprintf("UstLo: %d", v.UstLo)) + fieldVals = append(fieldVals, sprintf("MscHi: %d", v.MscHi)) + fieldVals = append(fieldVals, sprintf("MscLo: %d", v.MscLo)) + fieldVals = append(fieldVals, sprintf("Sbc: %d", v.Sbc)) + return "Dri2BufferSwapComplete {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewDri2BufferSwapCompleteEvent +} + +// Event definition Dri2InvalidateBuffers (1) +// Size: 32 + +const Dri2InvalidateBuffers = 1 + +type Dri2InvalidateBuffersEvent struct { + Sequence uint16 + // padding: 1 bytes + Drawable Id +} + +// Event read Dri2InvalidateBuffers +func NewDri2InvalidateBuffersEvent(buf []byte) Event { + v := Dri2InvalidateBuffersEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write Dri2InvalidateBuffers +func (v Dri2InvalidateBuffersEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + return buf +} + +func (v Dri2InvalidateBuffersEvent) ImplementsEvent() {} + +func (v Dri2InvalidateBuffersEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v Dri2InvalidateBuffersEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + return "Dri2InvalidateBuffers {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewDri2InvalidateBuffersEvent +} + +// Request Dri2QueryVersion +// size: 12 +type Dri2QueryVersionCookie struct { + *cookie +} + +func (c *Conn) Dri2QueryVersion(MajorVersion uint32, MinorVersion uint32) Dri2QueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2QueryVersionRequest(MajorVersion, MinorVersion), cookie) + return Dri2QueryVersionCookie{cookie} +} + +func (c *Conn) Dri2QueryVersionUnchecked(MajorVersion uint32, MinorVersion uint32) Dri2QueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2QueryVersionRequest(MajorVersion, MinorVersion), cookie) + return Dri2QueryVersionCookie{cookie} +} + +// Request reply for Dri2QueryVersion +// size: 16 +type Dri2QueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 +} + +// Waits and reads reply data from request Dri2QueryVersion +func (cook Dri2QueryVersionCookie) Reply() (*Dri2QueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2QueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for Dri2QueryVersion +func dri2QueryVersionReply(buf []byte) *Dri2QueryVersionReply { + v := new(Dri2QueryVersionReply) + 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.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2QueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2QueryVersion +func (c *Conn) dri2QueryVersionRequest(MajorVersion uint32, MinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + return buf +} + +// Request Dri2Connect +// size: 12 +type Dri2ConnectCookie struct { + *cookie +} + +func (c *Conn) Dri2Connect(Window Id, DriverType uint32) Dri2ConnectCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2ConnectRequest(Window, DriverType), cookie) + return Dri2ConnectCookie{cookie} +} + +func (c *Conn) Dri2ConnectUnchecked(Window Id, DriverType uint32) Dri2ConnectCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2ConnectRequest(Window, DriverType), cookie) + return Dri2ConnectCookie{cookie} +} + +// Request reply for Dri2Connect +// size: (((32 + pad((int(DriverNameLength) * 1))) + pad(((((int(DriverNameLength) + 3) & -4) - int(DriverNameLength)) * 1))) + pad((int(DeviceNameLength) * 1))) +type Dri2ConnectReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + DriverNameLength uint32 + DeviceNameLength uint32 + // padding: 16 bytes + DriverName string // size: pad((int(DriverNameLength) * 1)) + AlignmentPad []byte // size: pad(((((int(DriverNameLength) + 3) & -4) - int(DriverNameLength)) * 1)) + DeviceName string // size: pad((int(DeviceNameLength) * 1)) +} + +// Waits and reads reply data from request Dri2Connect +func (cook Dri2ConnectCookie) Reply() (*Dri2ConnectReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2ConnectReply(buf), nil +} + +// Read reply into structure from buffer for Dri2Connect +func dri2ConnectReply(buf []byte) *Dri2ConnectReply { + v := new(Dri2ConnectReply) + 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.DriverNameLength = Get32(buf[b:]) + b += 4 + + v.DeviceNameLength = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + { + byteString := make([]byte, v.DriverNameLength) + copy(byteString[:v.DriverNameLength], buf[b:]) + v.DriverName = string(byteString) + b += pad(int(v.DriverNameLength)) + } + + v.AlignmentPad = make([]byte, (((int(v.DriverNameLength) + 3) & -4) - int(v.DriverNameLength))) + copy(v.AlignmentPad[:(((int(v.DriverNameLength)+3)&-4)-int(v.DriverNameLength))], buf[b:]) + b += pad(int((((int(v.DriverNameLength) + 3) & -4) - int(v.DriverNameLength)))) + + { + byteString := make([]byte, v.DeviceNameLength) + copy(byteString[:v.DeviceNameLength], buf[b:]) + v.DeviceName = string(byteString) + b += pad(int(v.DeviceNameLength)) + } + + return v +} + +func (cook Dri2ConnectCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2Connect +func (c *Conn) dri2ConnectRequest(Window Id, DriverType uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Window)) + b += 4 + + Put32(buf[b:], DriverType) + b += 4 + + return buf +} + +// Request Dri2Authenticate +// size: 12 +type Dri2AuthenticateCookie struct { + *cookie +} + +func (c *Conn) Dri2Authenticate(Window Id, Magic uint32) Dri2AuthenticateCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2AuthenticateRequest(Window, Magic), cookie) + return Dri2AuthenticateCookie{cookie} +} + +func (c *Conn) Dri2AuthenticateUnchecked(Window Id, Magic uint32) Dri2AuthenticateCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2AuthenticateRequest(Window, Magic), cookie) + return Dri2AuthenticateCookie{cookie} +} + +// Request reply for Dri2Authenticate +// size: 12 +type Dri2AuthenticateReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Authenticated uint32 +} + +// Waits and reads reply data from request Dri2Authenticate +func (cook Dri2AuthenticateCookie) Reply() (*Dri2AuthenticateReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2AuthenticateReply(buf), nil +} + +// Read reply into structure from buffer for Dri2Authenticate +func dri2AuthenticateReply(buf []byte) *Dri2AuthenticateReply { + v := new(Dri2AuthenticateReply) + 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 Dri2AuthenticateCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2Authenticate +func (c *Conn) dri2AuthenticateRequest(Window Id, Magic uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Window)) + b += 4 + + Put32(buf[b:], Magic) + b += 4 + + return buf +} + +// Request Dri2CreateDrawable +// size: 8 +type Dri2CreateDrawableCookie struct { + *cookie +} + +// Write request to wire for Dri2CreateDrawable +func (c *Conn) Dri2CreateDrawable(Drawable Id) Dri2CreateDrawableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2CreateDrawableRequest(Drawable), cookie) + return Dri2CreateDrawableCookie{cookie} +} + +func (c *Conn) Dri2CreateDrawableChecked(Drawable Id) Dri2CreateDrawableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2CreateDrawableRequest(Drawable), cookie) + return Dri2CreateDrawableCookie{cookie} +} + +func (cook Dri2CreateDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2CreateDrawable +func (c *Conn) dri2CreateDrawableRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2DestroyDrawable +// size: 8 +type Dri2DestroyDrawableCookie struct { + *cookie +} + +// Write request to wire for Dri2DestroyDrawable +func (c *Conn) Dri2DestroyDrawable(Drawable Id) Dri2DestroyDrawableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2DestroyDrawableRequest(Drawable), cookie) + return Dri2DestroyDrawableCookie{cookie} +} + +func (c *Conn) Dri2DestroyDrawableChecked(Drawable Id) Dri2DestroyDrawableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2DestroyDrawableRequest(Drawable), cookie) + return Dri2DestroyDrawableCookie{cookie} +} + +func (cook Dri2DestroyDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2DestroyDrawable +func (c *Conn) dri2DestroyDrawableRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2GetBuffers +// size: pad((12 + pad((len(Attachments) * 4)))) +type Dri2GetBuffersCookie struct { + *cookie +} + +func (c *Conn) Dri2GetBuffers(Drawable Id, Count uint32, Attachments []uint32) Dri2GetBuffersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetBuffersRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersCookie{cookie} +} + +func (c *Conn) Dri2GetBuffersUnchecked(Drawable Id, Count uint32, Attachments []uint32) Dri2GetBuffersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetBuffersRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersCookie{cookie} +} + +// Request reply for Dri2GetBuffers +// size: (32 + pad((int(Count) * 20))) +type Dri2GetBuffersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint32 + Height uint32 + Count uint32 + // padding: 12 bytes + Buffers []Dri2DRI2Buffer // size: pad((int(Count) * 20)) +} + +// Waits and reads reply data from request Dri2GetBuffers +func (cook Dri2GetBuffersCookie) Reply() (*Dri2GetBuffersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetBuffersReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetBuffers +func dri2GetBuffersReply(buf []byte) *Dri2GetBuffersReply { + v := new(Dri2GetBuffersReply) + 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.Width = Get32(buf[b:]) + b += 4 + + v.Height = Get32(buf[b:]) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Buffers = make([]Dri2DRI2Buffer, v.Count) + b += ReadDri2DRI2BufferList(buf[b:], v.Buffers) + + return v +} + +func (cook Dri2GetBuffersCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetBuffers +func (c *Conn) dri2GetBuffersRequest(Drawable Id, Count uint32, Attachments []uint32) []byte { + size := pad((12 + pad((len(Attachments) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Count) + b += 4 + + for i := 0; i < int(len(Attachments)); i++ { + Put32(buf[b:], Attachments[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request Dri2CopyRegion +// size: 20 +type Dri2CopyRegionCookie struct { + *cookie +} + +func (c *Conn) Dri2CopyRegion(Drawable Id, Region uint32, Dest uint32, Src uint32) Dri2CopyRegionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2CopyRegionRequest(Drawable, Region, Dest, Src), cookie) + return Dri2CopyRegionCookie{cookie} +} + +func (c *Conn) Dri2CopyRegionUnchecked(Drawable Id, Region uint32, Dest uint32, Src uint32) Dri2CopyRegionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2CopyRegionRequest(Drawable, Region, Dest, Src), cookie) + return Dri2CopyRegionCookie{cookie} +} + +// Request reply for Dri2CopyRegion +// size: 8 +type Dri2CopyRegionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes +} + +// Waits and reads reply data from request Dri2CopyRegion +func (cook Dri2CopyRegionCookie) Reply() (*Dri2CopyRegionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2CopyRegionReply(buf), nil +} + +// Read reply into structure from buffer for Dri2CopyRegion +func dri2CopyRegionReply(buf []byte) *Dri2CopyRegionReply { + v := new(Dri2CopyRegionReply) + 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 + + return v +} + +func (cook Dri2CopyRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2CopyRegion +func (c *Conn) dri2CopyRegionRequest(Drawable Id, Region uint32, Dest uint32, Src uint32) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Region) + b += 4 + + Put32(buf[b:], Dest) + b += 4 + + Put32(buf[b:], Src) + b += 4 + + return buf +} + +// Request Dri2GetBuffersWithFormat +// size: pad((12 + pad((len(Attachments) * 8)))) +type Dri2GetBuffersWithFormatCookie struct { + *cookie +} + +func (c *Conn) Dri2GetBuffersWithFormat(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) Dri2GetBuffersWithFormatCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetBuffersWithFormatRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersWithFormatCookie{cookie} +} + +func (c *Conn) Dri2GetBuffersWithFormatUnchecked(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) Dri2GetBuffersWithFormatCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetBuffersWithFormatRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersWithFormatCookie{cookie} +} + +// Request reply for Dri2GetBuffersWithFormat +// size: (32 + pad((int(Count) * 20))) +type Dri2GetBuffersWithFormatReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint32 + Height uint32 + Count uint32 + // padding: 12 bytes + Buffers []Dri2DRI2Buffer // size: pad((int(Count) * 20)) +} + +// Waits and reads reply data from request Dri2GetBuffersWithFormat +func (cook Dri2GetBuffersWithFormatCookie) Reply() (*Dri2GetBuffersWithFormatReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetBuffersWithFormatReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetBuffersWithFormat +func dri2GetBuffersWithFormatReply(buf []byte) *Dri2GetBuffersWithFormatReply { + v := new(Dri2GetBuffersWithFormatReply) + 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.Width = Get32(buf[b:]) + b += 4 + + v.Height = Get32(buf[b:]) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Buffers = make([]Dri2DRI2Buffer, v.Count) + b += ReadDri2DRI2BufferList(buf[b:], v.Buffers) + + return v +} + +func (cook Dri2GetBuffersWithFormatCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetBuffersWithFormat +func (c *Conn) dri2GetBuffersWithFormatRequest(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) []byte { + size := pad((12 + pad((len(Attachments) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Count) + b += 4 + + b += Dri2AttachFormatListBytes(buf[b:], Attachments) + + return buf +} + +// Request Dri2SwapBuffers +// size: 32 +type Dri2SwapBuffersCookie struct { + *cookie +} + +func (c *Conn) Dri2SwapBuffers(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2SwapBuffersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2SwapBuffersRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2SwapBuffersCookie{cookie} +} + +func (c *Conn) Dri2SwapBuffersUnchecked(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2SwapBuffersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2SwapBuffersRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2SwapBuffersCookie{cookie} +} + +// Request reply for Dri2SwapBuffers +// size: 16 +type Dri2SwapBuffersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + SwapHi uint32 + SwapLo uint32 +} + +// Waits and reads reply data from request Dri2SwapBuffers +func (cook Dri2SwapBuffersCookie) Reply() (*Dri2SwapBuffersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2SwapBuffersReply(buf), nil +} + +// Read reply into structure from buffer for Dri2SwapBuffers +func dri2SwapBuffersReply(buf []byte) *Dri2SwapBuffersReply { + v := new(Dri2SwapBuffersReply) + 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.SwapHi = Get32(buf[b:]) + b += 4 + + v.SwapLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2SwapBuffersCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2SwapBuffers +func (c *Conn) dri2SwapBuffersRequest(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetMscHi) + b += 4 + + Put32(buf[b:], TargetMscLo) + b += 4 + + Put32(buf[b:], DivisorHi) + b += 4 + + Put32(buf[b:], DivisorLo) + b += 4 + + Put32(buf[b:], RemainderHi) + b += 4 + + Put32(buf[b:], RemainderLo) + b += 4 + + return buf +} + +// Request Dri2GetMSC +// size: 8 +type Dri2GetMSCCookie struct { + *cookie +} + +func (c *Conn) Dri2GetMSC(Drawable Id) Dri2GetMSCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetMSCRequest(Drawable), cookie) + return Dri2GetMSCCookie{cookie} +} + +func (c *Conn) Dri2GetMSCUnchecked(Drawable Id) Dri2GetMSCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetMSCRequest(Drawable), cookie) + return Dri2GetMSCCookie{cookie} +} + +// Request reply for Dri2GetMSC +// size: 32 +type Dri2GetMSCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2GetMSC +func (cook Dri2GetMSCCookie) Reply() (*Dri2GetMSCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetMSCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetMSC +func dri2GetMSCReply(buf []byte) *Dri2GetMSCReply { + v := new(Dri2GetMSCReply) + 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.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2GetMSCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetMSC +func (c *Conn) dri2GetMSCRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2WaitMSC +// size: 32 +type Dri2WaitMSCCookie struct { + *cookie +} + +func (c *Conn) Dri2WaitMSC(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2WaitMSCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2WaitMSCRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2WaitMSCCookie{cookie} +} + +func (c *Conn) Dri2WaitMSCUnchecked(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2WaitMSCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2WaitMSCRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2WaitMSCCookie{cookie} +} + +// Request reply for Dri2WaitMSC +// size: 32 +type Dri2WaitMSCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2WaitMSC +func (cook Dri2WaitMSCCookie) Reply() (*Dri2WaitMSCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2WaitMSCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2WaitMSC +func dri2WaitMSCReply(buf []byte) *Dri2WaitMSCReply { + v := new(Dri2WaitMSCReply) + 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.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2WaitMSCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2WaitMSC +func (c *Conn) dri2WaitMSCRequest(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetMscHi) + b += 4 + + Put32(buf[b:], TargetMscLo) + b += 4 + + Put32(buf[b:], DivisorHi) + b += 4 + + Put32(buf[b:], DivisorLo) + b += 4 + + Put32(buf[b:], RemainderHi) + b += 4 + + Put32(buf[b:], RemainderLo) + b += 4 + + return buf +} + +// Request Dri2WaitSBC +// size: 16 +type Dri2WaitSBCCookie struct { + *cookie +} + +func (c *Conn) Dri2WaitSBC(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) Dri2WaitSBCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2WaitSBCRequest(Drawable, TargetSbcHi, TargetSbcLo), cookie) + return Dri2WaitSBCCookie{cookie} +} + +func (c *Conn) Dri2WaitSBCUnchecked(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) Dri2WaitSBCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2WaitSBCRequest(Drawable, TargetSbcHi, TargetSbcLo), cookie) + return Dri2WaitSBCCookie{cookie} +} + +// Request reply for Dri2WaitSBC +// size: 32 +type Dri2WaitSBCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2WaitSBC +func (cook Dri2WaitSBCCookie) Reply() (*Dri2WaitSBCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2WaitSBCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2WaitSBC +func dri2WaitSBCReply(buf []byte) *Dri2WaitSBCReply { + v := new(Dri2WaitSBCReply) + 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.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2WaitSBCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2WaitSBC +func (c *Conn) dri2WaitSBCRequest(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + 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:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetSbcHi) + b += 4 + + Put32(buf[b:], TargetSbcLo) + b += 4 + + return buf +} + +// Request Dri2SwapInterval +// size: 12 +type Dri2SwapIntervalCookie struct { + *cookie +} + +// Write request to wire for Dri2SwapInterval +func (c *Conn) Dri2SwapInterval(Drawable Id, Interval uint32) Dri2SwapIntervalCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2SwapIntervalRequest(Drawable, Interval), cookie) + return Dri2SwapIntervalCookie{cookie} +} + +func (c *Conn) Dri2SwapIntervalChecked(Drawable Id, Interval uint32) Dri2SwapIntervalCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2SwapIntervalRequest(Drawable, Interval), cookie) + return Dri2SwapIntervalCookie{cookie} +} + +func (cook Dri2SwapIntervalCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2SwapInterval +func (c *Conn) dri2SwapIntervalRequest(Drawable Id, Interval uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Interval) + b += 4 + + return buf +} -- cgit v1.2.3