1848b8605SmrgName 2848b8605Smrg 3848b8605Smrg MESA_query_renderer 4848b8605Smrg 5848b8605SmrgName Strings 6848b8605Smrg 7848b8605Smrg GLX_MESA_query_renderer 8848b8605Smrg 9848b8605SmrgContact 10848b8605Smrg 11848b8605Smrg Ian Romanick <ian.d.romanick@intel.com> 12848b8605Smrg 13848b8605SmrgIP Status 14848b8605Smrg 15848b8605Smrg No known IP claims. 16848b8605Smrg 17848b8605SmrgStatus 18848b8605Smrg 19848b8605Smrg Shipping as of Mesa 10.0 20848b8605Smrg 21848b8605SmrgVersion 22848b8605Smrg 23b8e80941Smrg Version 9, 09 November 2018 24848b8605Smrg 25848b8605SmrgNumber 26848b8605Smrg 27b8e80941Smrg OpenGL Extension #446 28848b8605Smrg 29848b8605SmrgDependencies 30848b8605Smrg 31848b8605Smrg GLX 1.4 is required. 32848b8605Smrg 33848b8605Smrg GLX_ARB_create_context and GLX_ARB_create_context_profile are required. 34848b8605Smrg 35848b8605SmrgOverview 36848b8605Smrg 37848b8605Smrg In many situations, applications want to detect characteristics of a 38848b8605Smrg rendering device before creating a context for that device. Information 39848b8605Smrg gathered at this stage may guide choices the application makes about 40848b8605Smrg color depth, number of samples per-pixel, texture quality, and so on. 41848b8605Smrg In addition, versions of supported APIs and implementation API 42848b8605Smrg preference may also guide start-up decisions made by the application. 43848b8605Smrg For example, one implementation may prefer vertex data be supplied using 44848b8605Smrg methods only available in a compatibility profile, but another 45848b8605Smrg implementation may only support the desired version in a core profile. 46848b8605Smrg 47848b8605Smrg There are also cases where more than one renderer may be available per 48848b8605Smrg display. For example, there is typically a hardware implementation and 49848b8605Smrg a software based implementation. There are cases where an application 50848b8605Smrg may want to pick one over the other. One such situation is when the 51848b8605Smrg software implementation supports more features than the hardware 52848b8605Smrg implementation. Another situation is when a particular version of the 53848b8605Smrg hardware implementation is blacklisted due to known bugs. 54848b8605Smrg 55848b8605Smrg This extension provides a mechanism for the application to query all of 56848b8605Smrg the available renderers for a particular display and screen. In 57848b8605Smrg addition, this extension provides a mechanism for applications to create 58848b8605Smrg contexts with respect to a specific renderer. 59848b8605Smrg 60848b8605SmrgNew Procedures and Functions 61848b8605Smrg 62848b8605Smrg Bool glXQueryRendererIntegerMESA(Display *dpy, int screen, 63848b8605Smrg int renderer, int attribute, 64848b8605Smrg unsigned int *value); 65848b8605Smrg Bool glXQueryCurrentRendererIntegerMESA(int attribute, unsigned int *value); 66848b8605Smrg 67848b8605Smrg const char *glXQueryRendererStringMESA(Display *dpy, int screen, 68848b8605Smrg int renderer, int attribute); 69848b8605Smrg 70848b8605Smrg const char *glXQueryCurrentRendererStringMESA(int attribute); 71848b8605Smrg 72848b8605SmrgNew Tokens 73848b8605Smrg 74848b8605Smrg Accepted as an <attribute> in glXQueryRendererIntegerMESA and 75848b8605Smrg glXQueryCurrentRendererIntegerMESA: 76848b8605Smrg 77848b8605Smrg GLX_RENDERER_VENDOR_ID_MESA 0x8183 78848b8605Smrg GLX_RENDERER_DEVICE_ID_MESA 0x8184 79848b8605Smrg GLX_RENDERER_VERSION_MESA 0x8185 80848b8605Smrg GLX_RENDERER_ACCELERATED_MESA 0x8186 81848b8605Smrg GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 82848b8605Smrg GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 83848b8605Smrg GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 84848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A 85848b8605Smrg GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B 86848b8605Smrg GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C 87848b8605Smrg GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D 88848b8605Smrg 89848b8605Smrg Accepted as an <attribute> in glXQueryRendererStringMESA and 90848b8605Smrg glXQueryCurrentRendererStringMESA: 91848b8605Smrg 92848b8605Smrg GLX_RENDERER_VENDOR_ID_MESA 93848b8605Smrg GLX_RENDERER_DEVICE_ID_MESA 94848b8605Smrg 95848b8605SmrgAdditions to the OpenGL / WGL Specifications 96848b8605Smrg 97848b8605Smrg None. This specification is written for GLX. 98848b8605Smrg 99848b8605SmrgAdditions to the GLX 1.4 Specification 100848b8605Smrg 101b8e80941Smrg [Add to Section 3.3.2 "GLX Versioning" of the GLX Specification] 102848b8605Smrg 103848b8605Smrg To obtain information about the available renderers for a particular 104848b8605Smrg display and screen, 105848b8605Smrg 106848b8605Smrg Bool glXQueryRendererIntegerMESA(Display *dpy, int screen, int renderer, 107848b8605Smrg int attribute, unsigned int *value); 108848b8605Smrg 109848b8605Smrg can be used. The value for <attribute> will be returned in one or more 110848b8605Smrg integers specified by <value>. The values, data sizes, and descriptions 111848b8605Smrg of each renderer attribute are listed in the table below. 112848b8605Smrg 113848b8605Smrg GLX renderer attribute number description 114848b8605Smrg of values 115848b8605Smrg ---------------------- --------- ----------- 116848b8605Smrg GLX_RENDERER_VENDOR_ID_MESA 1 PCI ID of the device vendor 117848b8605Smrg GLX_RENDERER_DEVICE_ID_MESA 1 PCI ID of the device 118848b8605Smrg GLX_RENDERER_VERSION_MESA 3 Major, minor, and patch level of 119848b8605Smrg the renderer implementation 120848b8605Smrg GLX_RENDERER_ACCELERATED_MESA 1 Boolean indicating whether or 121848b8605Smrg not the renderer is hardware 122848b8605Smrg accelerated 123848b8605Smrg GLX_RENDERER_VIDEO_MEMORY_MESA 1 Number of megabytes of video 124848b8605Smrg memory available to the renderer 125848b8605Smrg GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 126848b8605Smrg 1 Boolean indicating whether or 127848b8605Smrg not the renderer uses a unified 128848b8605Smrg memory architecture or has 129848b8605Smrg separate "on-card" and GART 130848b8605Smrg memory. 131848b8605Smrg GLX_RENDERER_PREFERRED_PROFILE_MESA 132848b8605Smrg 1 Bitmask of the preferred context 133848b8605Smrg profile for this renderer. This 134848b8605Smrg value is suitable to be supplied 135848b8605Smrg with the 136848b8605Smrg GLX_CONTEXT_PROFILE_MASK_ARB 137848b8605Smrg attribute to 138848b8605Smrg glXCreateContextAttribsARB 139848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 140848b8605Smrg 2 Maximum core profile major and 141848b8605Smrg minor version supported by the 142848b8605Smrg renderer 143848b8605Smrg GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 144848b8605Smrg 2 Maximum compatibility profile 145848b8605Smrg major and minor version 146848b8605Smrg supported by the renderer 147848b8605Smrg GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 148848b8605Smrg 2 Maximum OpenGL ES 1.x 149848b8605Smrg major and minor version 150848b8605Smrg supported by the renderer 151848b8605Smrg GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 152848b8605Smrg 2 Maximum OpenGL ES 2.x or 3.x 153848b8605Smrg major and minor version 154848b8605Smrg supported by the renderer 155848b8605Smrg 156848b8605Smrg In the table, boolean attributes will have either the value 0 or 1. 157848b8605Smrg 158848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA, 159848b8605Smrg GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA, 160848b8605Smrg GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA, and 161848b8605Smrg GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA each return <0, 0> in 162848b8605Smrg *value if no version of that profile is supported. 163848b8605Smrg 164848b8605Smrg GLX_RENDERER_VENDOR_ID_MESA and GLX_RENDERER_DEVICE_ID_MESA may return 165848b8605Smrg 0xFFFFFFFF if the device does not have a PCI ID (because it is not a PCI 166848b8605Smrg device) or if the PCI ID is not available. In this case the application 167848b8605Smrg should rely on the string query instead. 168848b8605Smrg 169848b8605Smrg If <attribute> is not a recognized value, False is returned, but no GLX 170848b8605Smrg error is generated. Otherwise, True is returned. 171848b8605Smrg 172848b8605Smrg String versions of some attributes may also be queried using 173848b8605Smrg 174848b8605Smrg const char *glXQueryRendererStringMESA(Display *dpy, int screen, 175848b8605Smrg int renderer, int attribute); 176848b8605Smrg 177848b8605Smrg The value for <attribute> will be returned in one or more 178848b8605Smrg integers specified by <value>. The values, data sizes, and descriptions 179848b8605Smrg of each renderer attribute are listed in the table below. 180848b8605Smrg 181848b8605Smrg GLX renderer attribute description 182848b8605Smrg ---------------------- ----------- 183848b8605Smrg GLX_RENDERER_VENDOR_ID_MESA Name of the renderer provider. This may 184848b8605Smrg differ from the vendor name of the 185848b8605Smrg underlying hardware. 186848b8605Smrg GLX_RENDERER_DEVICE_ID_MESA Name of the renderer. This may differ from 187848b8605Smrg the name of the underlying hardware (e.g., 188848b8605Smrg for a software renderer). 189848b8605Smrg 190848b8605Smrg If <attribute> is not a recognized value, NULL is returned, but no GLX 191848b8605Smrg error is generated. 192848b8605Smrg 193848b8605Smrg The string returned for GLX_RENDERER_VENDOR_ID_MESA will have the same 194848b8605Smrg format as the string that would be returned by glGetString of GL_VENDOR. 195848b8605Smrg It may, however, have a different value. 196848b8605Smrg 197848b8605Smrg The string returned for GLX_RENDERER_DEVICE_ID_MESA will have the same 198848b8605Smrg format as the string that would be returned by glGetString of GL_RENDERER. 199848b8605Smrg It may, however, have a different value. 200848b8605Smrg 201848b8605SmrgIssues 202848b8605Smrg 203848b8605Smrg 1) How should the difference between on-card and GART memory be exposed? 204848b8605Smrg 205848b8605Smrg UNRESOLVED. 206848b8605Smrg 207848b8605Smrg 2) How should memory limitations of unified memory architecture (UMA) 208848b8605Smrg systems be exposed? 209848b8605Smrg 210848b8605Smrg UNRESOLVED. Some hardware has different per-process and global 211848b8605Smrg limits for memory that can be accessed within a single draw call. 212848b8605Smrg 213848b8605Smrg 3) How should the renderer's API preference be advertised? 214848b8605Smrg 215848b8605Smrg UNRESOLVED. The common case for desktop renderers is to prefer 216848b8605Smrg either core or compatibility. However, some renderers may actually 217848b8605Smrg prefer an ES context. This leaves the application in a tough spot 218848b8605Smrg if it can only support core or compatibility and the renderer says it 219848b8605Smrg wants ES. 220848b8605Smrg 221848b8605Smrg 4) Should OpenGL ES 2.0 and OpenGL ES 3.0 be treated separately? 222848b8605Smrg 223848b8605Smrg RESOLVED. No. OpenGL ES 3.0 is backwards compatible with OpenGL ES 224848b8605Smrg 2.0. Applications can detect OpenGL ES 3.0 support by querying 225848b8605Smrg GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA. 226848b8605Smrg 227848b8605Smrg 5) How can applications tell the difference between different hardware 228848b8605Smrg renderers for the same device? For example, whether the renderer is the 229848b8605Smrg open-source driver or the closed-source driver. 230848b8605Smrg 231848b8605Smrg RESOLVED. Assuming this extension is ever implemented outside Mesa, 232848b8605Smrg applications can query GLX_RENDERER_VENDOR_ID_MESA from 233848b8605Smrg glXQueryRendererStringMESA. This will almost certainly return 234848b8605Smrg different strings for open-source and closed-source drivers. 235848b8605Smrg 236848b8605Smrg 6) What is the value of GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA for 237848b8605Smrg software renderers? 238848b8605Smrg 239848b8605Smrg UNRESOLVED. Video (display) memory and texture memory is not unified 240848b8605Smrg for software implementations, so it seems reasonable for this to be 241848b8605Smrg False. 242848b8605Smrg 243848b8605Smrg 7) How does an application determine the number of available renderers? 244848b8605Smrg 245848b8605Smrg UNRESOLVED. 246848b8605Smrg 247848b8605Smrg 8) What happens if a fbconfig is used to create context on a renderer 248848b8605Smrg that cannot support it? For example, if a multisampled config is used 249848b8605Smrg with a software renderer that does not support multisampling. 250848b8605Smrg 251848b8605Smrg RESOLVED. The language for glXCreateContextAttribsARB already covers 252848b8605Smrg this case. Context creation will fail, and BadMatch is generated. 253848b8605Smrg 254848b8605Smrg 9) In addition to being able to query the supported versions, should 255848b8605Smrg applications also be able to query the supported extensions? 256848b8605Smrg 257848b8605Smrg RESOLVED. No. Desktop OpenGL core profiles and OpenGL ES 3.0 have 258848b8605Smrg moved away from the monolithic string returned by glGetString of 259848b8605Smrg GL_EXTENSIONS. Providing the newer indexed query would require adding 260848b8605Smrg a lot of extra infrastructure, and it would probably provide little 261848b8605Smrg benefit to applications. 262848b8605Smrg 263848b8605Smrg 10) What combination of values for GLX_RENDERER_PREFERRED_PROFILE_MESA, 264848b8605Smrg GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA, and 265848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA should be returned 266848b8605Smrg for a renderer that only supports OpenGL 3.1 without the 267848b8605Smrg GL_ARB_compatibility extension? 268848b8605Smrg 269848b8605Smrg RESOLVED. The renderer will return GLX_CONTEXT_CORE_PROFILE_BIT_ARB 270848b8605Smrg for GLX_RENDERER_PREFERRED_PROFILE_MESA. 271848b8605Smrg 272848b8605Smrg Further, the renderer will return <3,0> for 273848b8605Smrg GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA because OpenGL 274848b8605Smrg 3.1 without GL_ARB_compatibility is not backwards compatible with 275848b8605Smrg previous versions of OpenGL. The render will return <3,1> for 276848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA indicating that support 277848b8605Smrg for OpenGL 3.1 is available. 278848b8605Smrg 279848b8605Smrg Even though there is no OpenGL 3.1 core profile, the values 280848b8605Smrg returned for GLX_RENDERER_PREFERRED_PROFILE_MESA and 281848b8605Smrg GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA can be supplied 282848b8605Smrg with the GLX_CONTEXT_PROFILE_MASK_ARB and 283848b8605Smrg GLX_CONTEXT_{MAJOR,MINOR}_VERSION_ARB attributes of 284848b8605Smrg glXCreateContextAttribsARB without error. If the requested 285848b8605Smrg OpenGL version is less than 3.2, the 286848b8605Smrg GLX_CONTEXT_PROFILE_MASK_ARB attribute is ignored by 287848b8605Smrg glXCreateContextAttribsARB. 288848b8605Smrg 289848b8605Smrg 11) How can application learn about multi-GPU (e.g., SLI, CrossFireX, 290848b8605Smrg etc.) configurations? 291848b8605Smrg 292848b8605Smrg UNRESOLVED. Based on ISV feedback, this is important information to 293848b8605Smrg provide to the application. Given the variety of possible hardware 294848b8605Smrg configurations (e.g., Hybrid CrossFireX) and different rendering 295848b8605Smrg modes (e.g., split-frame rendering vs. alternate-frame rendering), 296848b8605Smrg it's not clear how this information can be communicated. 297848b8605Smrg 298848b8605Smrg It is likely that this will be left to a layered extension. 299848b8605Smrg 300848b8605Smrg 12) Should capability queries similar to those in 301848b8605Smrg GL_ARB_internalformat_query or GL_ARB_internalformat_query2 be added? 302848b8605Smrg 303848b8605Smrg RESOLVED. No. With the possible exception of the texture size 304848b8605Smrg queries, it seems unlikely that applications would ever use this 305848b8605Smrg information before creating a context. 306848b8605Smrg 307848b8605Smrg 13) Existing GL extensions (e.g., GL_ATI_meminfo and 308848b8605Smrg GL_NVX_gpu_memory_info) allow easy queries after context creation. With 309848b8605Smrg this extension it is a bit of a pain for a portable application to query 310848b8605Smrg the information after context creation. 311848b8605Smrg 312848b8605Smrg RESOLVED. Add versions of the queries that implicitly take the 313848b8605Smrg display, screen, and renderer from the currently bound context. 314848b8605Smrg 315848b8605Smrg 14) Why not make the queries from issue #13 GL functions (instead of GLX)? 316848b8605Smrg 317848b8605Smrg RESOLVED. It is fairly compelling for the post-creation queries to 318848b8605Smrg just use glGetInteger and glGetString. However, the GL enums and 319848b8605Smrg the GLX enums would have different names and would almost certainly 320848b8605Smrg have different values. It seems like this would cause more problems 321848b8605Smrg than it would solve. 322848b8605Smrg 323848b8605Smrg 15) Should the string queries be required to return the same values as 324848b8605Smrg glGetString(GL_VENDOR) and glGetString(GL_RENDERER)? 325848b8605Smrg 326848b8605Smrg UNRESOLVED. This may be useful for applications that already do 327848b8605Smrg device detection based on these strings. 328848b8605Smrg 329848b8605Smrg 16) What type should the value parameter of glXQueryRendererIntegerMESA 330848b8605Smrg and glXQueryCurrentRendererIntegerMESA be? 331848b8605Smrg 332848b8605Smrg UNRESOLVED. Other similar GLX query functions just use int or 333848b8605Smrg unsigned int, so that's what this extension uses for now. However, 334848b8605Smrg an expeclitly sized value, such as uint32_t or uint64_t, seems 335848b8605Smrg preferable. 336848b8605Smrg 337848b8605Smrg 17) What about SoCs and other systems that don't have PCI? 338848b8605Smrg 339848b8605Smrg RESOLVED. The GLX_RENDERER_VENDOR_ID_MESA and 340848b8605Smrg GLX_RENDERER_DEVICE_ID_MESA integer queries may return 0xFFFFFFFF if a 341848b8605Smrg PCI ID either does not exist or is not available. Implementations 342848b8605Smrg should make every attempt to return as much information as is 343848b8605Smrg possible. For example, if the implementation is running on a non-PCI 344848b8605Smrg SoC with a Qualcomm GPU, GLX_RENDERER_VENDOR_ID_MESA should return 345848b8605Smrg 0x5143, but GLX_RENDERER_DEVICE_ID_MESA will return 0xFFFFFFFF. 346848b8605Smrg 347848b8605SmrgRevision History 348848b8605Smrg 349848b8605Smrg Version 1, 2012/08/27 - Initial version 350848b8605Smrg 351848b8605Smrg Version 2, 2012/09/04 - Specify behavior of implementations that 352848b8605Smrg do not support certain profiles. 353848b8605Smrg Change wording of issue #8 to be more 354848b8605Smrg clear. 355848b8605Smrg Make some wording changes to issue #10 to 356848b8605Smrg clarify the resolution a bit. 357848b8605Smrg 358848b8605Smrg Version 3, 2012/09/23 - Add issue #11 regarding multi-GPU systems. 359848b8605Smrg 360848b8605Smrg Version 4, 2013/02/01 - Add issue #12 regarding texture / renderbuffer 361848b8605Smrg format queries. 362848b8605Smrg 363848b8605Smrg Version 5, 2013/02/14 - Add issues #13 and #14 regarding simpler queires 364848b8605Smrg after the context is created and made current. 365848b8605Smrg Add issue #15 regarding the string query. 366848b8605Smrg Add issue #16 regarding the value type returned 367848b8605Smrg by the Integer functions. 368848b8605Smrg 369848b8605Smrg Version 6, 2013/10/25 - Fix a typo. Update the list of functions to 370848b8605Smrg which the new enums can be passed. The "Current" 371848b8605Smrg versions were previously missing. 372848b8605Smrg 373848b8605Smrg Version 7, 2013/11/07 - Fix a couple more typos. Add issue #17 regarding 374848b8605Smrg the PCI queries on systems that don't have PCI. 375848b8605Smrg 376848b8605Smrg Version 8, 2014/02/14 - Fix a couple typos. GLX_RENDER_ID_MESA should 377848b8605Smrg read GLX_RENDERER_ID_MESA. The VENDOR/DEVICE_ID 378848b8605Smrg example given in issue #17 should be 0x5143 and 379848b8605Smrg 0xFFFFFFFF respectively. 380b8e80941Smrg 381b8e80941Smrg Version 9, 2018/11/09 - Remove GLX_RENDERER_ID_MESA, which has never been 382b8e80941Smrg implemented. Remove the unnecessary interactions 383b8e80941Smrg with the GLX GLES profile extensions. Note the 384b8e80941Smrg official GL extension number. Specify the section 385b8e80941Smrg of the GLX spec to modify. 386