15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_x11_sync_object 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_x11_sync_object 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Piers Daniell 125bd8deadSopenharmony_ci Pierre-Loup Griffais 135bd8deadSopenharmony_ci James Jones 145bd8deadSopenharmony_ci Aaron Plattner 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ciContact 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ci James Jones, NVIDIA corporation (jajones 'at' nvidia.com) 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciStatus 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Complete. 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciVersion 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Last Modified Date: Jan 26, 2011 275bd8deadSopenharmony_ci Author Revision: 2 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciNumber 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci 406 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciDependencies 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci OpenGL 3.2, or an earlier OpenGL version supporting the ARB_sync 365bd8deadSopenharmony_ci extension, is required. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Written based on the wording of the OpenGL 3.2 specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci ARB_cl_event trivially affects the definition of this extension. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci This extension is only supported with contexts created on an X11 435bd8deadSopenharmony_ci display that supports the X Synchronization Extension version 3.1 or 445bd8deadSopenharmony_ci later. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciOverview 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci Synchronization objects added the ability to better coordinate 495bd8deadSopenharmony_ci operations between multiple GL command streams. However, it is 505bd8deadSopenharmony_ci desirable to have the same level of coordination between GL 515bd8deadSopenharmony_ci command streams and external rendering APIs. This extension 525bd8deadSopenharmony_ci introduces two new concepts to build upon the synchronization 535bd8deadSopenharmony_ci infrastructure provided by ARB_sync: 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci 1) A means to import an X Synchronization Fence object into the 565bd8deadSopenharmony_ci GL and use it as a sync object. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci 2) The concept of a reusable sync object. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci The latter is necessary because the import operation is expensive 615bd8deadSopenharmony_ci and performing it every time a synchronization point was reached 625bd8deadSopenharmony_ci would make the synchronization prohibitively slow. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci This extension stops short of allowing the GL to change the state 655bd8deadSopenharmony_ci of imported/reusable sync objects, but does not add any language 665bd8deadSopenharmony_ci that would prohibit such functionality from being added in a 675bd8deadSopenharmony_ci subsequent extension. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciNew Procedures and Functions 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci sync ImportSyncEXT(enum external_sync_type, 725bd8deadSopenharmony_ci intptr external_sync, 735bd8deadSopenharmony_ci bitfield flags); 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciNew Types 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci None 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciNew Tokens 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci Accepted by the <external_sync_type> parameter of 825bd8deadSopenharmony_ci ImportSyncEXT: 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci SYNC_X11_FENCE_EXT 0x90E1 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.2 Specification (OpenGL 875bd8deadSopenharmony_ciOperation) 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci None 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.2 Specification (Rasterization) 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci None 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.2 Specification (Per-Fragment 965bd8deadSopenharmony_ciOperations and the Framebuffer) 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci None 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.2 Specification (Special 1015bd8deadSopenharmony_ciFunctions) 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Modify Section 5.2 "Sync Objects and Fences" (p. 241) 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci (Add after the seventh paragraph, p. 242) 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci "Additional types of sync objects can be imported from external 1085bd8deadSopenharmony_ci APIs. The command 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci sync ImportSyncEXT(enum external_sync_type, 1115bd8deadSopenharmony_ci intptr external_sync, 1125bd8deadSopenharmony_ci bitfield flags); 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci creates a GL sync object of the type <external_sync_type> based on 1155bd8deadSopenharmony_ci the object referred to by <external_sync>. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci "<external_sync_type> must be SYNC_X11_FENCE_EXT, and 1185bd8deadSopenharmony_ci <external_sync> must be the XID of a valid X11 Synchronization Fence 1195bd8deadSopenharmony_ci object. The status of the sync object returned will be SIGNALED 1205bd8deadSopenharmony_ci when the X object is in the triggered state, or UNSIGNALED 1215bd8deadSopenharmony_ci otherwise. 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci "<flags> must be 0." 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci (Replace the last sentence of paragraph 8, p. 242) 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci "The initial property values for a sync object created by FenceSync 1285bd8deadSopenharmony_ci or ImportSyncEXT are shown in tables 5.1 or 5.2 respectively. A 1295bd8deadSopenharmony_ci sync object created using ImportSyncEXT should hold a reference to 1305bd8deadSopenharmony_ci any external resources needed to maintain the GL state associated 1315bd8deadSopenharmony_ci with the GL object should the external object be destroyed." 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci (Replace paragraph 9 with the following, p. 242) 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci "If FenceSync or ImportSyncEXT fail to create a sync object, zero 1365bd8deadSopenharmony_ci will be returned and a GL error will be generated as described. An 1375bd8deadSopenharmony_ci INVALID_ENUM error is generated if <condition> is not 1385bd8deadSopenharmony_ci SYNC_GPU_COMMANDS_COMPLETE or <external_sync_type> is not 1395bd8deadSopenharmony_ci SYNC_X11_FENCE_EXT. If <flags> is not zero, or if <external_sync> 1405bd8deadSopenharmony_ci does not refer to a valid X Synchronization Fence object, an 1415bd8deadSopenharmony_ci INVALID_VALUE error is generated. 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci "However, implementations are not required to validate 1445bd8deadSopenharmony_ci <external_sync>, and passing an invalid external sync object handle 1455bd8deadSopenharmony_ci may result in undefined behavior up to and including program 1465bd8deadSopenharmony_ci termination." 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci (Add table 5.2 immediately following table 5.1, p. 243) 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Property Name Property Value 1515bd8deadSopenharmony_ci ------------------------ ------------------------------------- 1525bd8deadSopenharmony_ci OBJECT_TYPE <external_sync_type> 1535bd8deadSopenharmony_ci SYNC_CONDITION NONE 1545bd8deadSopenharmony_ci SYNC_STATUS dependent on state of <external_sync> 1555bd8deadSopenharmony_ci SYNC_FLAGS <flags> 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci Table 5.2: Initial properties of a sync object created with 1585bd8deadSopenharmony_ci ImportSyncEXT. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci (Replace paragraph 12 with the following, p. 243) 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci "If <sync> is in the signaled state, or if no ClientWaitSync or 1635bd8deadSopenharmony_ci WaitSync commands are blocking on <sync>, the object is deleted 1645bd8deadSopenharmony_ci immediately. Otherwise, <sync> is flagged for deletion and will be 1655bd8deadSopenharmony_ci deleted when it reaches the signaled state and is no longer blocking 1665bd8deadSopenharmony_ci any ClientWaitSync or WaitSync command. In either case, after 1675bd8deadSopenharmony_ci returning from DeleteSync the <sync> name is invalid and can no 1685bd8deadSopenharmony_ci longer be used to refer to the sync object. 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci Modify section 5.2.2 "Signaling" (p. 245) 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci (Replace the first paragraph with the following, p. 245) 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci "A sync object enters the signaled state only once the corresponding 1755bd8deadSopenharmony_ci fence command has completed and signaled the sync object, or the 1765bd8deadSopenharmony_ci external sync object associated with it has reached a state 1775bd8deadSopenharmony_ci corresponding to the GL signaled state as described in table 5.3." 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci (Add table 5.3) 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci OBJECT_TYPE External state corresponding to GL signaled state 1825bd8deadSopenharmony_ci ------------------ ------------------------------------------------- 1835bd8deadSopenharmony_ci SYNC_X11_FENCE_EXT triggered 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci (Replace the last sentence of the last paragraph with the following, 1865bd8deadSopenharmony_ci p. 246) 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci "Additionally, sync objects linked to external sync objects require 1895bd8deadSopenharmony_ci implementation-specific, non-queriable internal state uniquely 1905bd8deadSopenharmony_ci identifying the external object. The initial values of sync object 1915bd8deadSopenharmony_ci state are defined as specified by FenceSync and ImportSyncEXT." 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.2 Specification (State and State 1945bd8deadSopenharmony_ciRequests) 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci Modify section 6.1.7 "Sync Object State" (p. 256) 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci (Replace the last sentence of paragraph 4 with the following, p. 256) 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci "The only types supported are SYNC_FENCE and SYNC_X11_FENCE_EXT." 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciAdditions to Appendix D of the OpenGL 3.2 Specification (Shared Objects 2035bd8deadSopenharmony_ciand Multiple Contexts) 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci Modify section D.1.2 "Deleted Object and Object Name Lifetimes" 2065bd8deadSopenharmony_ci (p. 324) 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci Replace sentence 3 in the first paragraph with the following, (p. 324) 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci "A sync object is in use while it is not in the signaled state, or 2115bd8deadSopenharmony_ci while there are any GL clients and/or servers blocked on the sync 2125bd8deadSopenharmony_ci object as a result of ClientWaitSync or WaitSync commands." 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ciGLX Protocol 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci TBD 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ciDependencies on ARB_sync 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci ARB_sync or GL version 3.2 or above are required to implement this 2215bd8deadSopenharmony_ci extension. 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ciDependencies on ARB_cl_event 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci If ARB_cl_event is present, the language of the two specs must be 2265bd8deadSopenharmony_ci merged. There should be no technical conflicts, but the actual 2275bd8deadSopenharmony_ci text modifications overlap. 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ciErrors 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci The error INVALID_ENUM is generated if ImportSyncEXT is called 2325bd8deadSopenharmony_ci where <external_sync_type> is not SYNC_X11_FENCE_EXT. 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci The error INVALID_VALUE is generated if ImportSyncEXT is called 2355bd8deadSopenharmony_ci where <external_sync> does not refer to a valid X11 Synchronization 2365bd8deadSopenharmony_ci Fence object. 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci The error INVALID_VALUE is generated if ImportSyncEXT is called 2395bd8deadSopenharmony_ci where <flags> is not 0. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ciNew State 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci None 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ciIssues 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci 1) Should the import command be a generic entry point, or 2485bd8deadSopenharmony_ci specialized for X11 sync fence objects? 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci RESOLVED: A generic command is used. This command can be reused 2515bd8deadSopenharmony_ci by future extensions to import other sync types. It takes a 2525bd8deadSopenharmony_ci pointer-sized parameter that can be used to import any type of 2535bd8deadSopenharmony_ci synchronization object. Objects that require more than one 2545bd8deadSopenharmony_ci value to uniquely identify them, e.g. OpenCL events, can define 2555bd8deadSopenharmony_ci an intermediate structure that contains all required values and 2565bd8deadSopenharmony_ci then pass in a pointer to the structure. 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci 2) What happens if the X11 sync object is destroyed while the GL 2595bd8deadSopenharmony_ci sync object referencing it is still in use? 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci RESOLVED: The GL object should hold a reference on any resources 2625bd8deadSopenharmony_ci needed to continue using the sync object until the GL object is 2635bd8deadSopenharmony_ci deleted. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ciRevision History 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci Date: 26-Jan-2011 2685bd8deadSopenharmony_ci Revision: 2 (James Jones) 2695bd8deadSopenharmony_ci - Renamed from EXT_x_sync_object to EXT_x11_sync_object. 2705bd8deadSopenharmony_ci - Added issues 1 and 2 and related spec language. 2715bd8deadSopenharmony_ci - Added language describing when external syncs are signaled. 2725bd8deadSopenharmony_ci - Added language describing when external syncs are deleted. 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci Date: 20-Jan-2011 2755bd8deadSopenharmony_ci Revision: 1 (James Jones) 2765bd8deadSopenharmony_ci - Initial Revision. 277