Bug 3195 - i810: Setting GL_TEXTURE_LOD_BIAS_EXT can cause a segfault.
i810: Setting GL_TEXTURE_LOD_BIAS_EXT can cause a segfault.
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i810
git
x86 (IA32) Linux (All)
: medium critical
Assigned To: Default DRI bug account
http://sourceforge.net/tracker/index....
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-03 13:44 UTC by James Damour
Modified: 2009-08-24 12:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Damour 2005-05-03 13:44:16 UTC
When I try to set the GL_TEXTURE_LOD_BIAS_EXT of my OpenGL environment with the
following line, the Intel 810 driver
(extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c) sometimes suffers a
segmentation fault:
       glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -1.2);

Sadly, I can't seem to manufacture a simple test case.

This may *well* be due to pilot error; if so, I'd appreciate any advice on
correctly initializing the texture environment.  Still, I expect that OpenGL
drivers should never cause a segmentation fault when setting a parameter value,
so I'm submitting this report.

I can work around the problem by adding the following code:
+      if (!glIsEnabled(GL_TEXTURE_2D))
+      {
+         glEnable(GL_TEXTURE_2D);
+         glClear(0);
+         glDisable(GL_TEXTURE_2D);
+      }
       glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -1.2);


The following patch should avoid the segmentation fault altogether:
---cut here---
cvs diff -u ./xorg/xc/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c
Index: ./xorg/xc/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c
===================================================================
RCS file: /cvs/xorg/xc/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 i810tex.c
--- ./xorg/xc/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c   16 Jun 2004
09:18:05 -0000      1.1.1.1
+++ ./xorg/xc/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c   3 May 2005
20:14:32 -0000
@@ -319,9 +319,11 @@
    case GL_TEXTURE_LOD_BIAS_EXT:
       {
          struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
-         i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
-         t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
-         t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
+         if (tObj) {
+            i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
+            t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
+            t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
+         }
       }
       break;

---cut here---
Comment 1 Ian Romanick 2005-08-18 13:02:15 UTC
A fix has been committed to Mesa CVS.  It will be included in the 6.3.2 release,
and it will also be in X.org 6.9 / 7.0.  I also added a simple regression test
for this bug, which is located in progs/tests/bug_3195.c.
Comment 2 ajax at nwnk dot net 2009-08-24 12:23:15 UTC
Mass version move, cvs -> git