Bug 96979

Summary: Mesa 10.5.7 implementation error: Trying to disable permanently enabled extensions
Product: Mesa Reporter: Ruslan Kabatsayev <b7.10110111>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: 10.5   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: glxinfo.{i915,haswell} files used in the command leading to the error

Description Ruslan Kabatsayev 2016-07-18 19:40:16 UTC
I was trying to set up an environment looking as on i915 system, with actual device being a Haswell GPU. I used the following commands to get lists of extensions:

# get information about supported extensions on i915 machine
glxinfo -s | grep GL_ | cut -f 5 -d ' ' | sort | uniq > glxinfo.i915

# same on Haswell machine
glxinfo -s | grep GL_ | cut -f 5 -d ' ' | sort | uniq > glxinfo.haswell

Now on Haswell system I do this to disable the extensions not present on i915 system:

MESA_GL_VERSION_OVERRIDE=1.4 MESA_EXTENSION_OVERRIDE="$(diff -u ~/Dropbox/glxinfo.{haswell,i915} | grep '^-GL' | tr '\n' ' ')" gdb -ex r glxinfo

And here's the result:

name of display: :1
Mesa 10.5.7 implementation error: Trying to disable permanently enabled extensions: GL_APPLE_texture_max_level GL_EXT_color_buffer_float GL_EXT_discard_framebuffer GL_EXT_draw_buffers GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_fbo_color_attachments GL_NV_read_buffer GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_stencil8 GL_OES_surfaceless_context GL_OES_vertex_array_object
Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_NUM_EXTENSIONS)
Mesa: User error: GL_INVALID_VALUE in glGetStringi(index=124)

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
52              movdqu  (%edi), %xmm1
(gdb) bt
#0  __strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
#1  0x0804c0ab in build_core_profile_extension_list (extfuncs=0xffffc520) at glinfo_common.c:292
#2  0x08049a30 in print_screen_info (dpy=0x8055a10, scrnum=0, allowDirect=1, coreProfile=1, es2Profile=0, limits=0, singleLine=0, coreWorked=0) at glxinfo.c:471
#3  0x0804bb31 in main (argc=1, argv=0xffffc6d4) at glxinfo.c:1287
(gdb) f 1
#1  0x0804c0ab in build_core_profile_extension_list (extfuncs=0xffffc520) at glinfo_common.c:292
292           totalLen += strlen(ext) + 1; /* plus a space */


The main problem being here the "Mesa 10.5.7 implementation error". On i915 Mesa version is 10.5.9, so seems it should be similar in its permanently enabled extensions list.
Comment 1 Ruslan Kabatsayev 2016-07-18 19:42:49 UTC
Created attachment 125133 [details]
glxinfo.{i915,haswell} files used in the command leading to the error

Here're the lists of OpenGL extensions on i915 and Haswell GPU.
Comment 2 Kenneth Graunke 2016-07-18 22:02:03 UTC
This isn't something we want to support.

We should probably use fprintf rather than _mesa_problem so it doesn't print "Mesa: <version> implementation error" as it isn't an implementation issue - it's a warning to the user that the debug options they requested won't take effect because it's unsupported.
Comment 3 Ilia Mirkin 2016-07-18 23:14:58 UTC
(In reply to Kenneth Graunke from comment #2)
> This isn't something we want to support.
> 
> We should probably use fprintf rather than _mesa_problem so it doesn't print
> "Mesa: <version> implementation error" as it isn't an implementation issue -
> it's a warning to the user that the debug options they requested won't take
> effect because it's unsupported.

Actually the issue is that glxinfo hits a segfault later. I guess glGetStringi() or GL_NUM_EXTENSIONS gets confused...

As I recall, at some point Brian explicitly added support for disabling always-on exts. Not sure if that work was already in 10.5 or not... def worth checking a more recent version of mesa -- 10.5 is long out of support.
Comment 4 Ruslan Kabatsayev 2016-07-21 08:39:46 UTC
Trying this with Mesa 11.0.2 doesn't crash glxinfo, but I still get the following discrepancy:

$ glxinfo | grep GL_APPLE_texture_max_level
$ MESA_EXTENSION_OVERRIDE=-GL_APPLE_texture_max_level glxinfo >/dev/null
Mesa 11.0.2 implementation error: Trying to disable permanently enabled extensions: GL_APPLE_texture_max_level
Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa

I.e. despite the extension isn't listed by glxinfo, disabling it explicitly leads to error message saying that it's permanently enabled. It seems permanently enabled extensions should be present in glGetString(GL_EXTENSIONS) and similar API's results.
Comment 5 Emil Velikov 2016-07-21 10:16:40 UTC
With 12.0 (commit 21d43fe51ab5bcbc89ad5c61a51d3517c4243298) one should be able to disable permanently enabled extensions in a way that glGetString{,i} honours it.

IIRC the above patch depends it depends on other extensions work by Nanley so picking it on top of 11.0.x might fare too well.

Note that MESA_EXTENSION_OVERRIDE is aimed for development/workarounds and {en,dis}abling extension X does not magically {give,remove} all the functionality associated with it.
Comment 6 Ruslan Kabatsayev 2016-07-21 10:29:52 UTC
(In reply to Emil Velikov from comment #5)
> Note that MESA_EXTENSION_OVERRIDE is aimed for development/workarounds and
> {en,dis}abling extension X does not magically {give,remove} all the
> functionality associated with it.

By developers do you mean Mesa developers? Or application developers too? I was trying to use it to test Wine fallback code for the case when it would run on i915, but without having to even use this hardware for this — by just disabling the extensions i915 driver doesn't support/expose (based on glxinfo output on i915 machine).
Comment 7 Eero Tamminen 2016-07-21 11:22:33 UTC
Btw. If you're just testing whether Mesa would flip out on given HW and have an automated way of running your test-case (e.g. apitrace trace), you can override what PCI ID libdrm reports.  When underlying HW is faked, batches are dropped, but Mesa still does its own part.  As no rendering is then done, you cannot verify the results correctness though.
Comment 8 Ian Romanick 2016-07-21 16:21:09 UTC
(In reply to Eero Tamminen from comment #7)
> Btw. If you're just testing whether Mesa would flip out on given HW and have
> an automated way of running your test-case (e.g. apitrace trace), you can
> override what PCI ID libdrm reports.  When underlying HW is faked, batches
> are dropped, but Mesa still does its own part.  As no rendering is then
> done, you cannot verify the results correctness though.

Right... except he's trying to override to a different kind of hardware (i915 vs i965), so that won't work.
Comment 9 Ian Romanick 2016-07-21 16:24:39 UTC
(In reply to Ruslan Kabatsayev from comment #4)
> Trying this with Mesa 11.0.2 doesn't crash glxinfo, but I still get the
> following discrepancy:
> 
> $ glxinfo | grep GL_APPLE_texture_max_level
> $ MESA_EXTENSION_OVERRIDE=-GL_APPLE_texture_max_level glxinfo >/dev/null
> Mesa 11.0.2 implementation error: Trying to disable permanently enabled
> extensions: GL_APPLE_texture_max_level
> Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa
> 
> I.e. despite the extension isn't listed by glxinfo, disabling it explicitly
> leads to error message saying that it's permanently enabled. It seems
> permanently enabled extensions should be present in
> glGetString(GL_EXTENSIONS) and similar API's results.

In this particular case, GL_APPLE_texture_max_level is an OpenGL ES 1.x and 2.x extension.  I suspect the version of glxinfo you're using only shows desktop OpenGL information, so it makes sense that it doesn't show the ES extension.

It is confusing that Mesa gives an error message for disabling a extension that doesn't exist in the current API.  The code could be smarter about that.
Comment 10 Timothy Arceri 2018-04-10 05:54:48 UTC
(In reply to Emil Velikov from comment #5)
> With 12.0 (commit 21d43fe51ab5bcbc89ad5c61a51d3517c4243298) one should be
> able to disable permanently enabled extensions in a way that glGetString{,i}
> honours it.
> 
> IIRC the above patch depends it depends on other extensions work by Nanley
> so picking it on top of 11.0.x might fare too well.
> 
> Note that MESA_EXTENSION_OVERRIDE is aimed for development/workarounds and
> {en,dis}abling extension X does not magically {give,remove} all the
> functionality associated with it.

Assuming this was fixed. Closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.