Skip to content
  • Jonas Ådahl's avatar
    backends/native: Add basic KMS abstraction building blocks · fef5753a
    Jonas Ådahl authored and Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto committed
    The intention with KMS abstraction is to hide away accessing the drm
    functions behind an API that allows us to have different kind of KMS
    implementations, including legacy non-atomic and atomic. The intention
    is also that the code interacting with the drm device should be able to
    be run in a different thread than the main thread. This means that we
    need to make sure that all drm*() API usage must only occur from within
    tasks that eventually can be run in the dedicated thread.
    
    The idea here is that MetaKms provides a outward facing API other places
    of mutter can use (e.g. MetaGpuKms and friends), while MetaKmsImpl is
    an internal implementation that only gets interacted with via "tasks"
    posted via the MetaKms object. These tasks will in the future
    potentially be run on the dedicated KMS thread. Initially, we don't
    create any new threads.
    
    Likewise, MetaKmsDevice is a outward facing representation of a KMS
    device, while MetaKmsImplDevice is the corresponding implementation,
    which only runs from within the MetaKmsImpl tasks.
    
    This commit only moves opening and closing the device to this new API,
    while leaking the fd outside of the impl enclosure, effectively making
    the isolation for drm*() calls pointless. This, however, is necessary to
    allow gradual porting of drm interaction, and eventually the file
    descriptor in MetaGpuKms will be removed. For now, it's harmless, since
    everything still run in the main thread.
    
    GNOME/mutter#548
    GNOME/mutter!525
    fef5753a