Merge lp:~alan-griffiths/mir/bfi-fix-1416482 into lp:mir/0.11
Proposed by
Alan Griffiths
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2283 |
Proposed branch: | lp:~alan-griffiths/mir/bfi-fix-1416482 |
Merge into: | lp:mir/0.11 |
Diff against target: |
26 lines (+10/-0) 1 file modified
src/server/compositor/gl_program_family.cpp (+10/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/bfi-fix-1416482 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alexandros Frantzis (community) | Approve | ||
Review via email:
|
Commit message
compositor: avoid segfault when running two monitors "sidebyside"
Description of the change
compositor: avoid segfault when running two monitors "sidebyside"
I'm not really familiar with this area of code, so if there's a more elegant solution please suggest it.
To post a comment you must log in.
We need to serialize one level higher, in GLProgramFamily ::add_program( ), to ensure glCreateProgram() is also protected from concurrent access.
Note that we now have two points at which we allocate program and shader ids: GLProgramFamily
and GLProgramFactory (used only in the Android backend after a recent refactoring). Although they may be (or rather will be after this fix) invidually protected from concurrent access, in theory two threads could run concurrently in the two different classes. Not sure if it's a problem in practice, but ideally the two classes should also get synchronized or merged (not in this MP); we don't really need two implementations offering the same functionality.
Some background:
This was first addressed in r923 [1] :
/*
* We need to serialize renderer creation because some GL calls used
* during renderer construction that create unique resource ids
* (e.g. glCreateProgram) are not thread-safe when the threads are
* have the same or shared EGL contexts.
*/
Since then the code has been refactored multiple times and the serialization logic moved around. In a recent refactoring (the transition from GLProgramFactory to GLProgramFamily for GLRenderer), the serialization logic was lost.
[1] https:/ /bazaar. launchpad. net/~mir- team/mir/ 0.11/revision/ 923