Bug 26484

Summary: [GM965/GL960] GL_INVALID_VALUE (0x501) from glTexImage2D
Product: Mesa Reporter: Antonio Weber <antonio.weber>
Component: Mesa coreAssignee: Eric Anholt <eric>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium CC: idr
Version: unspecifiedKeywords: NEEDINFO
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Wine error, Xorg.0.log, xorg.conf, glxinfo ouput
debug output with backtrace output

Description Antonio Weber 2010-02-08 15:48:22 UTC
Created attachment 33183 [details]
Wine error, Xorg.0.log, xorg.conf, glxinfo ouput

I try to run EVE Online via wine on linux. The login screen shows up after a long time an the console is flooded with these 2 messages

fixme:d3d_surface:surface_allocate_surface >>>>>>>>>>>>>>>>> GL_INVALID_VALUE (0x501) from glTexImage2D @ surface.c / 602
fixme:d3d_surface:surface_upload_data >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from glCompressedTexSubImage2DARB @ surface.c / 532

I am not sure if this is the right place to report. I don't think its wine related because on my system with a nvidia card it works without problems so I assumed its some driver related stuff

System environment:
-- chipset: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller rev 3
-- system architecture: 64-bit
-- xf86-video-intel: version = 2.10.0
-- xserver: X.Org X Server 1.7.4
-- mesa: 7.7
-- libdrm: 2.4.17
-- kernel: Linux localhost 2.6.32-gentoo-r2 #2 SMP Sat Feb 6 02:09:12 CET 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T8100 @ 2.10GHz GenuineIntel GNU/Linux
-- Linux distribution: Gentoo
-- Machine or mobo model: Fujitsu Siemens Lifebook

Reproducing steps:

Well beside the relative big download of about 2 GB there are no futher steps needed. (Small description here http://wiki.eveonline.com/wiki/Install_EVE_on_linux_with_wine). No account needed because the problem appears before login

I attatch in one file the output of wine, the latest Xorg.0.log, the xorg.conf (beside the font dirs no changes were made) and the output of glxinfo
Comment 1 Eric Anholt 2010-02-11 13:50:21 UTC
Can you break on _mesa_error and find what the GL call is that's triggering the invalid value?
Comment 2 Antonio Weber 2010-02-14 13:44:23 UTC
Created attachment 33291 [details]
debug output with backtrace output

added code to imports.c to output backtrace information
Comment 3 Antonio Weber 2010-02-14 13:52:53 UTC
I had problems to break - perhaps its because of wine or something. I downloaded the 7.7 Mesa from http://www.mesa3d.org/relnotes-7.7.html and compiled it by myself. To output the stacktrace I added this short snipped of code (taken from glibc documentation :) )

what exacly do you need to know?

--- Mesa-7.7/src/mesa/main/imports.c	2010-02-14 22:38:30.487775140 +0100
***************
*** 1161,1166 ****
--- 1161,1188 ----
   * \param error the error value.
   * \param fmtString printf() style format string, followed by optional args
   */
+ 
+      /* Obtain a backtrace and print it to stdout. */
+      void
+      print_trace (void)
+      {
+        void *array[10];
+        size_t size;
+        char **strings;
+        size_t i;
+      
+        size = backtrace (array, 10);
+        strings = backtrace_symbols (array, size);
+      
+        printf ("Obtained %zd stack frames.\n", size);
+      
+        for (i = 0; i < size; i++)
+           printf ("%s\n", strings[i]);
+      
+        free (strings);
+      }
+ 
+ 
  void
  _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
  {
***************
*** 1201,1206 ****
--- 1223,1230 ----
  
           _mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
           output_if_debug("Mesa: User error", s2, GL_TRUE);
+ 
+ 	 print_trace();
           
           ctx->ErrorDebugFmtString = fmtString;
           ctx->ErrorDebugCount = 0;
***************
*** 1211,1216 ****
--- 1235,1241 ----
  }
Comment 4 Eric Anholt 2010-03-08 16:28:23 UTC
Reassigning it away from the Intel driver, since you aren't using it in the log with backtraces (you're using swrast).
Comment 5 Antonio Weber 2010-03-09 05:48:25 UTC
Ah ok. Is swrast a compatibility layer which forwards the calls? Because the i965_dri is also in use (as of lsof) 

ExeFile.e  1655       done  mem       REG        8,7  11480092  238362647 /home/done/Mesa-7.7/lib/swrast_dri.so
ExeFile.e  1655       done  mem       REG        8,7  16742226  238266415 /home/done/Mesa-7.7/lib/i965_dri.so
Comment 6 Ian Romanick 2010-03-18 15:23:34 UTC
(In reply to comment #5)
> Ah ok. Is swrast a compatibility layer which forwards the calls? Because the
> i965_dri is also in use (as of lsof) 
> 
> ExeFile.e  1655       done  mem       REG        8,7  11480092  238362647
> /home/done/Mesa-7.7/lib/swrast_dri.so
> ExeFile.e  1655       done  mem       REG        8,7  16742226  238266415
> /home/done/Mesa-7.7/lib/i965_dri.so

This probably means there is some missing symbol in your i965_dri.so.  libGL tries to load it, but the driver initialization fails.  libGL then falls back to swrast_dri.so and completely ignores i965_dri.so.  'LIBGL_DEBUG=verbose glxinfo' may shed some light on the issue.
Comment 7 Ian Romanick 2010-03-18 15:29:05 UTC
(In reply to comment #0)
> fixme:d3d_surface:surface_allocate_surface >>>>>>>>>>>>>>>>> GL_INVALID_VALUE
> (0x501) from glTexImage2D @ surface.c / 602
> fixme:d3d_surface:surface_upload_data >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500)
> from glCompressedTexSubImage2DARB @ surface.c / 532

I'll bet a shinny nickle that the app is trying to give S3TC data to a driver that doesn't support S3TC.  A printf in _mesa_CompressedTexSubImage2DARB of format will settle it right quick.  If format is from the following list, the app is erroneously sending S3TC:

#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
#define GL_RGB_S3TC                       0x83A0
#define GL_RGB4_S3TC                      0x83A1
#define GL_RGBA_S3TC                      0x83A2
#define GL_RGBA4_S3TC                     0x83A3
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT  0x8C4C
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
Comment 8 Ian Romanick 2010-10-25 13:31:16 UTC
Waited 9 months for a reply and got none.  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.