File: gh_bug6_check.py

package info (click to toggle)
pyopengl 3.1.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,668 kB
  • sloc: python: 108,024; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (3)
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
#! /usr/bin/env python3
import os, logging, glob, ctypes
os.environ['PYOPENGL_PLATFORM'] = 'egl'
log = logging.getLogger(__name__)
import OpenGL
from OpenGL.EGL import gbmdevice
from OpenGL.EGL import *
from OpenGL.EGL.EXT.platform_base import *
from OpenGL.EGL.MESA.platform_gbm import *

def main():
    for device in gbmdevice.enumerate_devices():
        log.info("Checking device: %s", device)
        device = gbmdevice.open_device(device)
        try:
            display = eglGetPlatformDisplayEXT(
                EGL_PLATFORM_GBM_MESA, 
                device, 
                ctypes.c_void_p(0)
            )
            if display == EGL_NO_DISPLAY:
                log.error("Failed to get platform display for %s", display)
            else:
                log.info("Got platform display %s", display)
        finally:
            gbmdevice.close_device(device)

if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    main()