This file is indexed.

/usr/lib/python3/dist-packages/xcffib/dri2.py is in python3-xcffib 0.3.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 4
key = xcffib.ExtensionKey("DRI2")
_events = {}
_errors = {}
from . import xproto
class Attachment:
    BufferFrontLeft = 0
    BufferBackLeft = 1
    BufferFrontRight = 2
    BufferBackRight = 3
    BufferDepth = 4
    BufferStencil = 5
    BufferAccum = 6
    BufferFakeFrontLeft = 7
    BufferFakeFrontRight = 8
    BufferDepthStencil = 9
    BufferHiz = 10
class DriverType:
    DRI = 0
    VDPAU = 1
class EventType:
    ExchangeComplete = 1
    BlitComplete = 2
    FlipComplete = 3
class DRI2Buffer(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.attachment, self.name, self.pitch, self.cpp, self.flags = unpacker.unpack("IIIII")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=IIIII", self.attachment, self.name, self.pitch, self.cpp, self.flags))
        return buf.getvalue()
    fixed_size = 20
class AttachFormat(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.attachment, self.format = unpacker.unpack("II")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=II", self.attachment, self.format))
        return buf.getvalue()
    fixed_size = 8
class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xx2x4xII")
        self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply
class ConnectReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.driver_name_length, self.device_name_length = unpacker.unpack("xx2x4xII16x")
        self.driver_name = xcffib.List(unpacker, "c", self.driver_name_length)
        unpacker.pad("c")
        self.alignment_pad = xcffib.List(unpacker, "c", ((self.driver_name_length + 3) & (~ 3)) - self.driver_name_length)
        unpacker.pad("c")
        self.device_name = xcffib.List(unpacker, "c", self.device_name_length)
        self.bufsize = unpacker.offset - base
class ConnectCookie(xcffib.Cookie):
    reply_type = ConnectReply
class AuthenticateReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.authenticated, = unpacker.unpack("xx2x4xI")
        self.bufsize = unpacker.offset - base
class AuthenticateCookie(xcffib.Cookie):
    reply_type = AuthenticateReply
class GetBuffersReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.width, self.height, self.count = unpacker.unpack("xx2x4xIII12x")
        self.buffers = xcffib.List(unpacker, DRI2Buffer, self.count)
        self.bufsize = unpacker.offset - base
class GetBuffersCookie(xcffib.Cookie):
    reply_type = GetBuffersReply
class CopyRegionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        unpacker.unpack("xx2x4x")
        self.bufsize = unpacker.offset - base
class CopyRegionCookie(xcffib.Cookie):
    reply_type = CopyRegionReply
class GetBuffersWithFormatReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.width, self.height, self.count = unpacker.unpack("xx2x4xIII12x")
        self.buffers = xcffib.List(unpacker, DRI2Buffer, self.count)
        self.bufsize = unpacker.offset - base
class GetBuffersWithFormatCookie(xcffib.Cookie):
    reply_type = GetBuffersWithFormatReply
class SwapBuffersReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.swap_hi, self.swap_lo = unpacker.unpack("xx2x4xII")
        self.bufsize = unpacker.offset - base
class SwapBuffersCookie(xcffib.Cookie):
    reply_type = SwapBuffersReply
class GetMSCReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII")
        self.bufsize = unpacker.offset - base
class GetMSCCookie(xcffib.Cookie):
    reply_type = GetMSCReply
class WaitMSCReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII")
        self.bufsize = unpacker.offset - base
class WaitMSCCookie(xcffib.Cookie):
    reply_type = WaitMSCReply
class WaitSBCReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII")
        self.bufsize = unpacker.offset - base
class WaitSBCCookie(xcffib.Cookie):
    reply_type = WaitSBCReply
class GetParamReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.is_param_recognized, self.value_hi, self.value_lo = unpacker.unpack("xB2x4xII")
        self.bufsize = unpacker.offset - base
class GetParamCookie(xcffib.Cookie):
    reply_type = GetParamReply
class BufferSwapCompleteEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        self.event_type, self.drawable, self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc = unpacker.unpack("xx2xH2xIIIIII")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 0))
        buf.write(struct.pack("=x2xH2xIIIIII", self.event_type, self.drawable, self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
        return buf.getvalue()
_events[0] = BufferSwapCompleteEvent
class InvalidateBuffersEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        self.drawable, = unpacker.unpack("xx2xI")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 1))
        buf.write(struct.pack("=x2xI", self.drawable))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
        return buf.getvalue()
_events[1] = InvalidateBuffersEvent
class dri2Extension(xcffib.Extension):
    def QueryVersion(self, major_version, minor_version, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", major_version, minor_version))
        return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
    def Connect(self, window, driver_type, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", window, driver_type))
        return self.send_request(1, buf, ConnectCookie, is_checked=is_checked)
    def Authenticate(self, window, magic, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", window, magic))
        return self.send_request(2, buf, AuthenticateCookie, is_checked=is_checked)
    def CreateDrawable(self, drawable, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", drawable))
        return self.send_request(3, buf, is_checked=is_checked)
    def DestroyDrawable(self, drawable, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", drawable))
        return self.send_request(4, buf, is_checked=is_checked)
    def GetBuffers(self, drawable, count, attachments, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, count))
        buf.write(xcffib.pack_list(attachments, "I"))
        return self.send_request(5, buf, GetBuffersCookie, is_checked=is_checked)
    def CopyRegion(self, drawable, region, dest, src, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIIII", drawable, region, dest, src))
        return self.send_request(6, buf, CopyRegionCookie, is_checked=is_checked)
    def GetBuffersWithFormat(self, drawable, count, attachments, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, count))
        buf.write(xcffib.pack_list(attachments, AttachFormat))
        return self.send_request(7, buf, GetBuffersWithFormatCookie, is_checked=is_checked)
    def SwapBuffers(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIIIIIII", drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo))
        return self.send_request(8, buf, SwapBuffersCookie, is_checked=is_checked)
    def GetMSC(self, drawable, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", drawable))
        return self.send_request(9, buf, GetMSCCookie, is_checked=is_checked)
    def WaitMSC(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIIIIIII", drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo))
        return self.send_request(10, buf, WaitMSCCookie, is_checked=is_checked)
    def WaitSBC(self, drawable, target_sbc_hi, target_sbc_lo, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIII", drawable, target_sbc_hi, target_sbc_lo))
        return self.send_request(11, buf, WaitSBCCookie, is_checked=is_checked)
    def SwapInterval(self, drawable, interval, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, interval))
        return self.send_request(12, buf, is_checked=is_checked)
    def GetParam(self, drawable, param, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, param))
        return self.send_request(13, buf, GetParamCookie, is_checked=is_checked)
xcffib._add_ext(key, dri2Extension, _events, _errors)