Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • L libglvnd
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • glvnd
  • libglvnd
  • Merge requests
  • !270

Draft: Implement EGL_EXT_display_alloc

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Kyle Brenneman requested to merge kbrenneman/libglvnd:add-EGL_EXT_display_alloc into master Jul 18, 2022
  • Overview 0
  • Commits 21
  • Pipelines 1
  • Changes 22

This is a draft to implement EGL_EXT_display_alloc in libglvnd.

Most of this involves reworking the hashtable that keeps track of EGLDisplays, and updating things so that it can cope with displays being modified and destroyed.

To avoid problems where one thread might try to destroy an EGLDisplay while another thread is using it, the __EGLdisplayInfo struct now has a refcount. The mutex for the display hashtable is also used to protect the refcount.

Anything that holds on to a pointer to a __EGLdisplayInfo either has to increment the refcount or it needs to hold the mutex for the display hashtable (since nothing else can drop the refcount to zero without holding the mutex). If all it needs to do is look up a vendor for an EGLDisplay (which is most cases), then it can still take a shared lock.

There's also counters for the number of times an EGLDisplay has been initialized and how many threads have it as their current display, so that it knows when it's safe to destroy an EGLDisplay. As a side effect of that, libglvnd now implements most of EGL_KHR_display_reference internally.

As currently implemented, a vendor library does have to have matching bookkeeping for current and init counts as libglvnd. In theory, libglvnd could handle all of that internally, and then defer calling the vendor's eglDestroyDisplayEXT call until the EGLDisplay is ready to be deleted. However, that might happen during thread termination if the EGLDisplay is already terminated and marked for deletion, and only current on that thread. In that case, the vendor's TLS destructor might have already run.

Also note that with the last change (releasing the display hashtable lock for most of eglMakeCurrent), I haven't worked through all of the various permutations of multiple EGLDisplays and multiple vendors yet, so I'm not quite confident that everything there works.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: add-EGL_EXT_display_alloc