/usr/lib/python3/dist-packages/xcffib/xf86dri.py is in python3-xcffib 0.5.1-1build3.
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 | import xcffib
import struct
import six
MAJOR_VERSION = 4
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XFree86-DRI")
_events = {}
_errors = {}
class DrmClipRect(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.x1, self.y1, self.x2, self.x3 = unpacker.unpack("hhhh")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=hhhh", self.x1, self.y1, self.x2, self.x3))
return buf.getvalue()
fixed_size = 8
@classmethod
def synthetic(cls, x1, y1, x2, x3):
self = cls.__new__(cls)
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.x3 = x3
return self
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.dri_major_version, self.dri_minor_version, self.dri_minor_patch = unpacker.unpack("xx2x4xHHI")
self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
reply_type = QueryVersionReply
class QueryDirectRenderingCapableReply(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_capable, = unpacker.unpack("xx2x4xB")
self.bufsize = unpacker.offset - base
class QueryDirectRenderingCapableCookie(xcffib.Cookie):
reply_type = QueryDirectRenderingCapableReply
class OpenConnectionReply(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.sarea_handle_low, self.sarea_handle_high, self.bus_id_len = unpacker.unpack("xx2x4xIII12x")
self.bus_id = xcffib.List(unpacker, "c", self.bus_id_len)
self.bufsize = unpacker.offset - base
class OpenConnectionCookie(xcffib.Cookie):
reply_type = OpenConnectionReply
class GetClientDriverNameReply(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.client_driver_major_version, self.client_driver_minor_version, self.client_driver_patch_version, self.client_driver_name_len = unpacker.unpack("xx2x4xIIII8x")
self.client_driver_name = xcffib.List(unpacker, "c", self.client_driver_name_len)
self.bufsize = unpacker.offset - base
class GetClientDriverNameCookie(xcffib.Cookie):
reply_type = GetClientDriverNameReply
class CreateContextReply(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.hw_context, = unpacker.unpack("xx2x4xI")
self.bufsize = unpacker.offset - base
class CreateContextCookie(xcffib.Cookie):
reply_type = CreateContextReply
class CreateDrawableReply(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.hw_drawable_handle, = unpacker.unpack("xx2x4xI")
self.bufsize = unpacker.offset - base
class CreateDrawableCookie(xcffib.Cookie):
reply_type = CreateDrawableReply
class GetDrawableInfoReply(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.drawable_table_index, self.drawable_table_stamp, self.drawable_origin_X, self.drawable_origin_Y, self.drawable_size_W, self.drawable_size_H, self.num_clip_rects, self.back_x, self.back_y, self.num_back_clip_rects = unpacker.unpack("xx2x4xIIhhhhIhhI")
self.clip_rects = xcffib.List(unpacker, DrmClipRect, self.num_clip_rects)
unpacker.pad(DrmClipRect)
self.back_clip_rects = xcffib.List(unpacker, DrmClipRect, self.num_back_clip_rects)
self.bufsize = unpacker.offset - base
class GetDrawableInfoCookie(xcffib.Cookie):
reply_type = GetDrawableInfoReply
class GetDeviceInfoReply(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.framebuffer_handle_low, self.framebuffer_handle_high, self.framebuffer_origin_offset, self.framebuffer_size, self.framebuffer_stride, self.device_private_size = unpacker.unpack("xx2x4xIIIIII")
self.device_private = xcffib.List(unpacker, "I", self.device_private_size)
self.bufsize = unpacker.offset - base
class GetDeviceInfoCookie(xcffib.Cookie):
reply_type = GetDeviceInfoReply
class AuthConnectionReply(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 AuthConnectionCookie(xcffib.Cookie):
reply_type = AuthConnectionReply
class xf86driExtension(xcffib.Extension):
def QueryVersion(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def QueryDirectRenderingCapable(self, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(1, buf, QueryDirectRenderingCapableCookie, is_checked=is_checked)
def OpenConnection(self, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(2, buf, OpenConnectionCookie, is_checked=is_checked)
def CloseConnection(self, screen, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(3, buf, is_checked=is_checked)
def GetClientDriverName(self, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(4, buf, GetClientDriverNameCookie, is_checked=is_checked)
def CreateContext(self, screen, visual, context, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIII", screen, visual, context))
return self.send_request(5, buf, CreateContextCookie, is_checked=is_checked)
def DestroyContext(self, screen, context, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", screen, context))
return self.send_request(6, buf, is_checked=is_checked)
def CreateDrawable(self, screen, drawable, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", screen, drawable))
return self.send_request(7, buf, CreateDrawableCookie, is_checked=is_checked)
def DestroyDrawable(self, screen, drawable, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", screen, drawable))
return self.send_request(8, buf, is_checked=is_checked)
def GetDrawableInfo(self, screen, drawable, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", screen, drawable))
return self.send_request(9, buf, GetDrawableInfoCookie, is_checked=is_checked)
def GetDeviceInfo(self, screen, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", screen))
return self.send_request(10, buf, GetDeviceInfoCookie, is_checked=is_checked)
def AuthConnection(self, screen, magic, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", screen, magic))
return self.send_request(11, buf, AuthConnectionCookie, is_checked=is_checked)
xcffib._add_ext(key, xf86driExtension, _events, _errors)
|