Example #1
0
"""
import weakref, ctypes, logging, os, glob
from OpenGL.platform import ctypesloader
from OpenGL import _opaque
log = logging.getLogger(__name__)
gbm = ctypesloader.loadLibrary(ctypes.CDLL,"gbm")
__all__ = ("enumerate_devices","open_device","close_device","gbm")
_DEVICE_HANDLES = {}
GBM_BO_USE_SCANOUT = (1 << 0)
GBM_BO_USE_CURSOR = (1 << 1)
GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR
GBM_BO_USE_RENDERING = (1 << 2)
GBM_BO_USE_WRITE = (1 << 3)
GBM_BO_USE_LINEAR = (1 << 4)

GBMDevice = _opaque.opaque_pointer_cls("GBMDevice")
GBMSurface = _opaque.opaque_pointer_cls("GBMSurface")
gbm.gbm_create_device.restype = GBMDevice
gbm.gbm_surface_create.restype = GBMSurface

def filter_bad_drivers(cards, bad_drivers=("nvidia",)):
    """Lookup the driver for each card to exclude loading nvidia devices"""
    # this is pci specific, which I suppose means we"re going to fail
    # if the GPU isn"t on the PCI bus, but we don"t seem to have
    # another way to match up the card to the driver :(
    bad_cards = set()
    for link in glob.glob("/dev/dri/by-path/pci-*-card"):
        base = os.path.basename(link)
        pci_id = base[4:-5]
        driver = os.path.basename(os.readlink("/sys/bus/pci/devices/%s/driver"%(pci_id,)))
        if driver in bad_drivers:
Example #2
0
"""
import weakref, ctypes, logging, os, glob
from OpenGL.platform import ctypesloader
from OpenGL import _opaque
log = logging.getLogger(__name__)
gbm = ctypesloader.loadLibrary(ctypes.CDLL, "gbm")
__all__ = ('enumerate_devices', 'open_device', 'close_device', 'gbm')
_DEVICE_HANDLES = {}
GBM_BO_USE_SCANOUT = (1 << 0)
GBM_BO_USE_CURSOR = (1 << 1)
GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR
GBM_BO_USE_RENDERING = (1 << 2)
GBM_BO_USE_WRITE = (1 << 3)
GBM_BO_USE_LINEAR = (1 << 4)

GBMDevice = _opaque.opaque_pointer_cls('GBMDevice')
GBMSurface = _opaque.opaque_pointer_cls('GBMSurface')
gbm.gbm_create_device.restype = GBMDevice
gbm.gbm_surface_create.restype = GBMSurface


def filter_bad_drivers(cards, bad_drivers=('nvidia', )):
    """Lookup the driver for each card to exclude loading nvidia devices"""
    # this is pci specific, which I suppose means we're going to fail
    # if the GPU isn't on the PCI bus, but we don't seem to have
    # another way to match up the card to the driver :(
    bad_cards = set()
    for link in glob.glob('/dev/dri/by-path/pci-*-card'):
        base = os.path.basename(link)
        pci_id = base[4:-5]
        driver = os.path.basename(
Example #3
0
def define_egl_ext_structure(struct_name):
    if hasattr(egl, struct_name):
        return  # structure already exists
    from OpenGL._opaque import opaque_pointer_cls
    setattr(egl, struct_name, opaque_pointer_cls(struct_name))
Example #4
0
def _get_egl_struct(struct_name):
    from OpenGL._opaque import opaque_pointer_cls
    return opaque_pointer_cls(struct_name)
Example #5
0
import ctypes
from OpenGL import _opaque
GLenum = ctypes.c_uint
GLboolean = ctypes.c_ubyte
GLsizei = ctypes.c_int
GLint = ctypes.c_int
OSMesaContext = _opaque.opaque_pointer_cls('OSMesaContext')

__all__ = [
    'OSMesaContext',
]
Example #6
0
import ctypes
from OpenGL import _opaque
GLenum = ctypes.c_uint
GLboolean = ctypes.c_ubyte
GLsizei = ctypes.c_int
GLint = ctypes.c_int
OSMesaContext = _opaque.opaque_pointer_cls("OSMesaContext")

__all__ = [
    "OSMesaContext",
]
Example #7
0
import ctypes
from OpenGL import _opaque
GLenum = ctypes.c_uint
GLboolean = ctypes.c_ubyte
GLsizei = ctypes.c_int
GLint = ctypes.c_int
OSMesaContext = _opaque.opaque_pointer_cls( 'OSMesaContext' )

__all__ = [
    'OSMesaContext',
]
Example #8
0
def define_egl_ext_structure(struct_name):
    if hasattr(egl, struct_name):
        return  # structure already exists
    from OpenGL._opaque import opaque_pointer_cls
    setattr(egl, struct_name, opaque_pointer_cls(struct_name))