revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / libs / mesa / docs / MESA_multithread_makecurrent.spec
blob5065c2fc0a351a130e182be950cf7eaef8c725f6
1 Name
3 MESA_multithread_makecurrent
5 Name Strings
7 GLX_MESA_multithread_makecurrent
9 Contact
11 Eric Anholt (eric@anholt.net)
13 Status
15 Not shipping.
17 Version
19 Last Modified Date: 21 February 2011
21 Number
23 TBD
25 Dependencies
27 OpenGL 1.0 or later is required.
28 GLX 1.3 or later is required.
30 Overview
32 The GLX context setup encourages multithreaded applications to
33 create a context per thread which each operate on their own
34 objects in parallel, and leaves synchronization for write access
35 to shared objects up to the application.
37 For some applications, maintaining per-thread contexts and
38 ensuring that the glFlush happens in one thread before another
39 thread starts working on that object is difficult. For them,
40 using the same context across multiple threads and protecting its
41 usage with a mutex is both higher performance and easier to
42 implement. This extension gives those applications that option by
43 relaxing the context binding requirements.
45 This new behavior matches the requirements of AGL, while providing
46 a feature not specified in WGL.
48 IP Status
50 Open-source; freely implementable.
52 Issues
54 None.
56 New Procedures and Functions
58 None.
60 New Tokens
62 None.
64 Changes to Chapter 2 of the GLX 1.3 Specification (Functions and Errors)
66 Replace the following sentence from section 2.2 Rendering Contexts:
67 In addition, a rendering context can be current for only one
68 thread at a time.
69 with:
70 In addition, an indirect rendering context can be current for
71 only one thread at a time. A direct rendering context may be
72 current to multiple threads, with synchronization of access to
73 the context thruogh the GL managed by the application through
74 mutexes.
76 Changes to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
78 Replace the following sentence from section 3.3.7 Rendering Contexts:
79 If ctx is current to some other thread, then
80 glXMakeContextCurrent will generate a BadAccess error.
81 with:
82 If ctx is an indirect context current to some other thread,
83 then glXMakeContextCurrent will generate a BadAccess error.
85 Replace the following sentence from section 3.5 Rendering Contexts:
86 If ctx is current to some other thread, then
87 glXMakeCurrent will generate a BadAccess error.
88 with:
89 If ctx is an indirect context current to some other thread,
90 then glXMakeCurrent will generate a BadAccess error.
92 GLX Protocol
94 None. The GLX extension only extends to direct rendering contexts.
96 Errors
98 None.
100 New State
102 None.
104 Issues
106 (1) What happens if the app binds a context/drawable in multiple
107 threads, then binds a different context/thread in one of them?
109 As with binding a new context from the current thread, the old
110 context's refcount is reduced and the new context's refcount is
111 increased.
113 (2) What happens if the app binds a context/drawable in multiple
114 threads, then binds None/None in one of them?
116 The GLX context is unreferenced from that thread, and the other
117 threads retain their GLX context binding.
119 (3) What happens if the app binds a context/drawable in 7 threads,
120 then destroys the context in one of them?
122 As with GLX context destruction previously, the XID is destroyed
123 but the context remains usable by threads that have the context
124 current.
126 (4) What happens if the app binds a new drawable/readable with
127 glXMakeCurrent() when it is already bound to another thread?
129 The context becomes bound to the new drawable/readable, and
130 further rendering in either thread will use the new
131 drawable/readable.
133 (5) What requirements should be placed on the user managing contexts
134 from multiple threads?
136 The intention is to allow multithreaded access to the GL at the
137 minimal performance cost, so requiring that the GL do general
138 synchronization (beyond that already required by context sharing)
139 is not an option, and synchronizing of GL's access to the GL
140 context between multiple threads is left to the application to do
141 across GL calls. However, it would be unfortunate for a library
142 doing multithread_makecurrent to require that other libraries
143 share in synchronization for binding of their own contexts, so the
144 refcounting of the contexts is required to be threadsafe.
146 (6) Does this apply to indirect contexts?
148 This was ignored in the initial revision of the spec. Behavior
149 for indirect contexts is left as-is.
151 Revision History
153 20 November 2009 Eric Anholt - initial specification
154 22 November 2009 Eric Anholt - added issues from Ian Romanick.
155 3 February 2011 Eric Anholt - updated with resolution to issues 1-3
156 3 February 2011 Eric Anholt - added issue 4, 5
157 21 February 2011 Eric Anholt - Include glXMakeCurrent() sentence
158 along with glXMakeContextCurrent() for removal.