summaryrefslogtreecommitdiff
path: root/drm.py
diff options
context:
space:
mode:
Diffstat (limited to 'drm.py')
-rw-r--r--drm.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/drm.py b/drm.py
new file mode 100644
index 0000000..16e92f9
--- /dev/null
+++ b/drm.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+from ctypes import *
+
+class drm_api(Structure):
+ pass
+
+drm_api._fields_ = [
+ ("destroy", CFUNCTYPE(None, POINTER(drm_api))),
+ ("name", c_char_p),
+ ("driver_name", c_char_p),
+ ("create_screen",
+ CFUNCTYPE(c_void_p, POINTER(drm_api), c_int, c_void_p)),
+]
+
+class DrmApi(object):
+
+ def __init__(self, handle):
+ self.drm_api = handle.drm_api_create()
+
+ def __del__(self):
+ self.drm_api[0].destroy(self.drm_api)
+
+ def create_screen(self, fd):
+ screen = self.drm_api[0].create_screen(self.drm_api, fd, None)
+ print screen
+
+ @property
+ def name(self):
+ return self.drm_api[0].name