mesa: replace VP/FP/ATIfs _Enabled flags with helper functions
[mesa.git] / src / mesa / drivers / dri / r200 / r200_tcl.c
index ca9a8dbf8c27505e97a0bee708670f7ab345249c..662c041c79f2e707c2a8e9aead19a4e4e828b979 100644 (file)
@@ -29,15 +29,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /*
  * Authors:
- *   Keith Whitwell <keith@tungstengraphics.com>
+ *   Keith Whitwell <keithw@vmware.com>
  */
 
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
 #include "main/enums.h"
-#include "main/colormac.h"
 #include "main/light.h"
+#include "main/state.h"
 
 #include "vbo/vbo.h"
 #include "tnl/tnl.h"
@@ -46,11 +46,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r200_context.h"
 #include "r200_state.h"
 #include "r200_ioctl.h"
-#include "r200_tex.h"
 #include "r200_tcl.h"
 #include "r200_swtcl.h"
 #include "r200_maos.h"
 
+#include "radeon_common_context.h"
+
 
 
 #define HAVE_POINTS      1
@@ -59,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define HAVE_LINE_STRIPS 1
 #define HAVE_TRIANGLES   1
 #define HAVE_TRI_STRIPS  1
-#define HAVE_TRI_STRIP_1 0
 #define HAVE_TRI_FANS    1
 #define HAVE_QUADS       1
 #define HAVE_QUAD_STRIPS 1
@@ -67,9 +67,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define HAVE_ELTS        1
 
 
-#define HW_POINTS           ((ctx->Point.PointSprite || \
-                               ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) && \
-                               !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ? \
+#define HW_POINTS           ((!ctx->Point.SmoothFlag) ? \
                                R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS)
 #define HW_LINES            R200_VF_PRIM_LINES
 #define HW_LINE_LOOP        0
@@ -109,7 +107,7 @@ static GLboolean discrete_prim[0x10] = {
 #define ELT_INIT(prim, hw_prim) \
    r200TclPrimitive( ctx, prim, hw_prim | R200_VF_PRIM_WALK_IND )
 
-#define GET_MESA_ELTS() rmesa->tcl.Elts
+#define GET_MESA_ELTS() TNL_CONTEXT(ctx)->vb.Elts
 
 
 /* Don't really know how many elts will fit in what's left of cmdbuf,
@@ -154,13 +152,12 @@ static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr )
    }
    else {
       if (rmesa->radeon.dma.flush)
-        rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
-
-      rcommonEnsureCmdBufSpace(&rmesa->radeon, AOS_BUFSZ(rmesa->radeon.tcl.aos_count), __FUNCTION__);
+        rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
 
       r200EmitAOS( rmesa,
                   rmesa->radeon.tcl.aos_count, 0 );
 
+      r200EmitMaxVtxIndex(rmesa, rmesa->radeon.tcl.aos[0].count);
       return r200AllocEltsOpenEnded( rmesa, rmesa->tcl.hw_primitive, nr );
    }
 }
@@ -177,7 +174,7 @@ while (0)
  * discrete and there are no intervening state changes.  (Somewhat
  * duplicates changes to DrawArrays code)
  */
-static void r200EmitPrim( GLcontext *ctx, 
+static void r200EmitPrim( struct gl_context *ctx, 
                          GLenum prim, 
                          GLuint hwprim, 
                          GLuint start, 
@@ -187,9 +184,6 @@ static void r200EmitPrim( GLcontext *ctx,
    r200TclPrimitive( ctx, prim, hwprim );
    
    //   fprintf(stderr,"Emit prim %d\n", rmesa->radeon.tcl.aos_count);
-   rcommonEnsureCmdBufSpace( &rmesa->radeon,
-                            AOS_BUFSZ(rmesa->radeon.tcl.aos_count) +
-                            rmesa->radeon.hw.max_state_size + VBUF_BUFSZ, __FUNCTION__ );
 
    r200EmitAOS( rmesa,
                rmesa->radeon.tcl.aos_count,
@@ -206,6 +200,7 @@ static void r200EmitPrim( GLcontext *ctx,
    r200EmitPrim( ctx, prim, hwprim, start, count );             \
    (void) rmesa; } while (0)
 
+#define MAX_CONVERSION_SIZE 40
 /* Try & join small primitives
  */
 #if 0
@@ -222,8 +217,8 @@ static void r200EmitPrim( GLcontext *ctx,
 #ifdef MESA_BIG_ENDIAN
 /* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
 #define EMIT_ELT(dest, offset, x) do {                          \
-        int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 );     \
-        GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 );    \
+        int off = offset + ( ( (uintptr_t)dest & 0x2 ) >> 1 );     \
+        GLushort *des = (GLushort *)( (uintptr_t)dest & ~0x2 );    \
         (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x);    \
        (void)rmesa; } while (0)
 #else
@@ -243,7 +238,7 @@ static void r200EmitPrim( GLcontext *ctx,
 /*                          External entrypoints                     */
 /**********************************************************************/
 
-void r200EmitPrimitive( GLcontext *ctx, 
+void r200EmitPrimitive( struct gl_context *ctx, 
                          GLuint first,
                          GLuint last,
                          GLuint flags )
@@ -251,7 +246,7 @@ void r200EmitPrimitive( GLcontext *ctx,
    tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
 }
 
-void r200EmitEltPrimitive( GLcontext *ctx, 
+void r200EmitEltPrimitive( struct gl_context *ctx, 
                             GLuint first,
                             GLuint last,
                             GLuint flags )
@@ -259,13 +254,17 @@ void r200EmitEltPrimitive( GLcontext *ctx,
    tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
 }
 
-void r200TclPrimitive( GLcontext *ctx, 
+void r200TclPrimitive( struct gl_context *ctx, 
                         GLenum prim,
                         int hw_prim )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
 
+   radeon_prepare_render(&rmesa->radeon);
+   if (rmesa->radeon.NewGLState)
+      r200ValidateState( ctx );
+
    if (newprim != rmesa->tcl.hw_primitive ||
        !discrete_prim[hw_prim&0xf]) {
       /* need to disable perspective-correct texturing for point sprites */
@@ -284,88 +283,65 @@ void r200TclPrimitive( GLcontext *ctx,
    }
 }
 
-
-/**********************************************************************/
-/*             Fog blend factor computation for hw tcl                */
-/*             same calculation used as in t_vb_fog.c                 */
-/**********************************************************************/
-
-#define FOG_EXP_TABLE_SIZE 256
-#define FOG_MAX (10.0)
-#define EXP_FOG_MAX .0006595
-#define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE)
-static GLfloat exp_table[FOG_EXP_TABLE_SIZE];
-
-#if 1
-#define NEG_EXP( result, narg )                                                \
-do {                                                                   \
-   GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR));                      \
-   GLint k = (GLint) f;                                                        \
-   if (k > FOG_EXP_TABLE_SIZE-2)                                       \
-      result = (GLfloat) EXP_FOG_MAX;                                  \
-   else                                                                        \
-      result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]);     \
-} while (0)
-#else
-#define NEG_EXP( result, narg )                                        \
-do {                                                           \
-   result = exp(-narg);                                                \
-} while (0)
-#endif
-
-
 /**
- * Initialize the exp_table[] lookup table for approximating exp().
+ * Predict total emit size for next rendering operation so there is no flush in middle of rendering
+ * Prediction has to aim towards the best possible value that is worse than worst case scenario
  */
-void
-r200InitStaticFogData( void )
+static GLuint r200EnsureEmitSize( struct gl_context * ctx , GLubyte* vimap_rev )
 {
-   GLfloat f = 0.0F;
-   GLint i = 0;
-   for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) {
-      exp_table[i] = (GLfloat) exp(-f);
-   }
-}
-
-
-/**
- * Compute per-vertex fog blend factors from fog coordinates by
- * evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function.
- * Fog coordinates are distances from the eye (typically between the
- * near and far clip plane distances).
- * Note the fog (eye Z) coords may be negative so we use ABS(z) below.
- * Fog blend factors are in the range [0,1].
- */
-float
-r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord )
-{
-   GLfloat end  = ctx->Fog.End;
-   GLfloat d, temp;
-   const GLfloat z = FABSF(fogcoord);
-
-   switch (ctx->Fog.Mode) {
-   case GL_LINEAR:
-      if (ctx->Fog.Start == ctx->Fog.End)
-         d = 1.0F;
+  r200ContextPtr rmesa = R200_CONTEXT(ctx);
+  TNLcontext *tnl = TNL_CONTEXT(ctx);
+  struct vertex_buffer *VB = &tnl->vb;
+  GLuint space_required;
+  GLuint state_size;
+  GLuint nr_aos = 0;
+  int i;
+  /* predict number of aos to emit */
+  for (i = 0; i < 15; ++i)
+  {
+    if (vimap_rev[i] != 255)
+    {
+      ++nr_aos;
+    }
+  }
+
+  {
+    /* count the prediction for state size */
+    space_required = 0;
+    state_size = radeonCountStateEmitSize( &rmesa->radeon );
+    /* vtx may be changed in r200EmitArrays so account for it if not dirty */
+    if (!rmesa->hw.vtx.dirty)
+      state_size += rmesa->hw.vtx.check(&rmesa->radeon.glCtx, &rmesa->hw.vtx);
+    /* predict size for elements */
+    for (i = 0; i < VB->PrimitiveCount; ++i)
+    {
+      if (!VB->Primitive[i].count)
+       continue;
+      /* If primitive.count is less than MAX_CONVERSION_SIZE
+         rendering code may decide convert to elts.
+        In that case we have to make pessimistic prediction.
+        and use larger of 2 paths. */
+      const GLuint elt_count =(VB->Primitive[i].count/GET_MAX_HW_ELTS() + 1);
+      const GLuint elts = ELTS_BUFSZ(nr_aos) * elt_count;
+      const GLuint index = INDEX_BUFSZ * elt_count;
+      const GLuint vbuf = VBUF_BUFSZ;
+      if ( (!VB->Elts && VB->Primitive[i].count >= MAX_CONVERSION_SIZE)
+         || vbuf > index + elts)
+       space_required += vbuf;
       else
-         d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
-      temp = (end - z) * d;
-      return CLAMP(temp, 0.0F, 1.0F);
-      break;
-   case GL_EXP:
-      d = ctx->Fog.Density;
-      NEG_EXP( temp, d * z );
-      return temp;
-      break;
-   case GL_EXP2:
-      d = ctx->Fog.Density*ctx->Fog.Density;
-      NEG_EXP( temp, d * z * z );
-      return temp;
-      break;
-   default:
-      _mesa_problem(ctx, "Bad fog mode in make_fog_coord");
-      return 0;
-   }
+       space_required += index + elts;
+      space_required += AOS_BUFSZ(nr_aos);
+    }
+  }
+
+  radeon_print(RADEON_RENDER,RADEON_VERBOSE,
+      "%s space %u, aos %d\n",
+      __func__, space_required, AOS_BUFSZ(nr_aos) );
+  /* flush the buffer in case we need more than is left. */
+  if (rcommonEnsureCmdBufSpace(&rmesa->radeon, space_required + state_size, __func__))
+    return space_required + radeonCountStateEmitSize( &rmesa->radeon );
+  else
+    return space_required + state_size;
 }
 
 
@@ -376,7 +352,7 @@ r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord )
 
 /* TCL render.
  */
-static GLboolean r200_run_tcl_render( GLcontext *ctx,
+static GLboolean r200_run_tcl_render( struct gl_context *ctx,
                                      struct tnl_pipeline_stage *stage )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
@@ -396,8 +372,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
    if (rmesa->radeon.TclFallback)
       return GL_TRUE;  /* fallback to software t&l */
 
-   if (R200_DEBUG & DEBUG_PRIMS)
-      fprintf(stderr, "%s\n", __FUNCTION__);
+   radeon_print(RADEON_RENDER, RADEON_NORMAL, "%s\n", __func__);
 
    if (VB->Count == 0)
       return GL_FALSE;
@@ -408,7 +383,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
       if (!r200ValidateState( ctx ))
          return GL_TRUE; /* fallback to sw t&l */
 
-   if (!ctx->VertexProgram._Enabled) {
+   if (!_mesa_arb_vertex_program_enabled(ctx)) {
    /* NOTE: inputs != tnl->render_inputs - these are the untransformed
     * inputs.
     */
@@ -426,7 +401,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
          FIXME: OTOH, we're missing the case where a ATI_fragment_shader accesses
          the secondary color (if lighting is disabled). The chip seems
          misconfigured for that though elsewhere (tcl output, might lock up) */
-      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
+      if (_mesa_need_secondary_color(ctx)) {
         map_rev_fixed[5] = VERT_ATTRIB_COLOR1;
       }
 
@@ -435,7 +410,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
       }
 
       for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) {
-        if (ctx->Texture.Unit[i]._ReallyEnabled) {
+        if (ctx->Texture.Unit[i]._Current) {
            if (rmesa->TexGenNeedNormals[i]) {
               map_rev_fixed[2] = VERT_ATTRIB_NORMAL;
            }
@@ -451,26 +426,27 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
         prog to a not enabled output however, so just don't mess with it.
         We only need to change compsel. */
       GLuint out_compsel = 0;
-      GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
+      const GLbitfield64 vp_out =
+        rmesa->curr_vp_hw->mesa_program.info.outputs_written;
 
       vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
-      assert(vp_out & (1 << VERT_RESULT_HPOS));
+      assert(vp_out & BITFIELD64_BIT(VARYING_SLOT_POS));
       out_compsel = R200_OUTPUT_XYZW;
-      if (vp_out & (1 << VERT_RESULT_COL0)) {
+      if (vp_out & BITFIELD64_BIT(VARYING_SLOT_COL0)) {
         out_compsel |= R200_OUTPUT_COLOR_0;
       }
-      if (vp_out & (1 << VERT_RESULT_COL1)) {
+      if (vp_out & BITFIELD64_BIT(VARYING_SLOT_COL1)) {
         out_compsel |= R200_OUTPUT_COLOR_1;
       }
-      if (vp_out & (1 << VERT_RESULT_FOGC)) {
+      if (vp_out & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
          out_compsel |= R200_OUTPUT_DISCRETE_FOG;
       }
-      if (vp_out & (1 << VERT_RESULT_PSIZ)) {
+      if (vp_out & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
         out_compsel |= R200_OUTPUT_PT_SIZE;
       }
-      for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) {
-        if (vp_out & (1 << i)) {
-           out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0);
+      for (i = VARYING_SLOT_TEX0; i < VARYING_SLOT_TEX6; i++) {
+        if (vp_out & BITFIELD64_BIT(i)) {
+           out_compsel |= R200_OUTPUT_TEX_0 << (i - VARYING_SLOT_TEX0);
         }
       }
       if (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel) {
@@ -482,10 +458,10 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
    /* Do the actual work:
     */
    radeonReleaseArrays( ctx, ~0 /* stage->changed_inputs */ );
+   GLuint emit_end = r200EnsureEmitSize( ctx, vimap_rev )
+     + rmesa->radeon.cmdbuf.cs->cdw;
    r200EmitArrays( ctx, vimap_rev );
 
-   rmesa->tcl.Elts = VB->Elts;
-
    for (i = 0 ; i < VB->PrimitiveCount ; i++)
    {
       GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
@@ -495,11 +471,14 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
       if (!length)
         continue;
 
-      if (rmesa->tcl.Elts)
+      if (VB->Elts)
         r200EmitEltPrimitive( ctx, start, start+length, prim );
       else
         r200EmitPrimitive( ctx, start, start+length, prim );
    }
+   if ( emit_end < rmesa->radeon.cmdbuf.cs->cdw )
+     WARN_ONCE("Rendering was %d commands larger than predicted size."
+        " We might overflow  command buffer.\n", rmesa->radeon.cmdbuf.cs->cdw - emit_end);
 
    return GL_FALSE;            /* finished the pipe */
 }
@@ -530,7 +509,7 @@ const struct tnl_pipeline_stage _r200_tcl_stage =
  */
 
 
-static void transition_to_swtnl( GLcontext *ctx )
+static void transition_to_swtnl( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -540,10 +519,10 @@ static void transition_to_swtnl( GLcontext *ctx )
    r200ChooseVertexState( ctx );
    r200ChooseRenderState( ctx );
 
-   _mesa_validate_all_lighting_tables( ctx ); 
+   _tnl_validate_shine_tables( ctx ); 
 
    tnl->Driver.NotifyMaterialChange = 
-      _mesa_validate_all_lighting_tables;
+      _tnl_validate_shine_tables;
 
    radeonReleaseArrays( ctx, ~0 );
 
@@ -554,7 +533,7 @@ static void transition_to_swtnl( GLcontext *ctx )
    rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~(R200_VAP_TCL_ENABLE|R200_VAP_PROG_VTX_SHADER_ENABLE);
 }
 
-static void transition_to_hwtnl( GLcontext *ctx )
+static void transition_to_hwtnl( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -566,7 +545,7 @@ static void transition_to_hwtnl( GLcontext *ctx )
    tnl->Driver.NotifyMaterialChange = r200UpdateMaterial;
 
    if ( rmesa->radeon.dma.flush )                      
-      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  
+      rmesa->radeon.dma.flush( &rmesa->radeon.glCtx ); 
 
    rmesa->radeon.dma.flush = NULL;
    
@@ -574,7 +553,7 @@ static void transition_to_hwtnl( GLcontext *ctx )
    rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE;
    rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_FORCE_W_TO_ONE;
 
-   if (ctx->VertexProgram._Enabled) {
+   if (_mesa_arb_vertex_program_enabled(ctx)) {
       rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_PROG_VTX_SHADER_ENABLE;
    }
 
@@ -590,7 +569,7 @@ static void transition_to_hwtnl( GLcontext *ctx )
    rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT);
    rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] |= R200_VTX_W0_FMT;
 
-   if (R200_DEBUG & DEBUG_FALLBACKS) 
+   if (R200_DEBUG & RADEON_FALLBACKS)
       fprintf(stderr, "R200 end tcl fallback\n");
 }
 
@@ -624,27 +603,36 @@ static char *getFallbackString(GLuint bit)
 
 
 
-void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
 {
-   r200ContextPtr rmesa = R200_CONTEXT(ctx);
-   GLuint oldfallback = rmesa->radeon.TclFallback;
-
-   if (mode) {
-      rmesa->radeon.TclFallback |= bit;
-      if (oldfallback == 0) {
-        if (R200_DEBUG & DEBUG_FALLBACKS) 
-           fprintf(stderr, "R200 begin tcl fallback %s\n",
-                   getFallbackString( bit ));
-        transition_to_swtnl( ctx );
-      }
-   }
-   else {
-      rmesa->radeon.TclFallback &= ~bit;
-      if (oldfallback == bit) {
-        if (R200_DEBUG & DEBUG_FALLBACKS) 
-           fprintf(stderr, "R200 end tcl fallback %s\n",
-                   getFallbackString( bit ));
-        transition_to_hwtnl( ctx );
-      }
-   }
+       r200ContextPtr rmesa = R200_CONTEXT(ctx);
+       GLuint oldfallback = rmesa->radeon.TclFallback;
+
+       if (mode) {
+               if (oldfallback == 0) {
+                       /* We have to flush before transition */
+                       if ( rmesa->radeon.dma.flush )
+                               rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
+
+                       if (R200_DEBUG & RADEON_FALLBACKS)
+                               fprintf(stderr, "R200 begin tcl fallback %s\n",
+                                               getFallbackString( bit ));
+                       rmesa->radeon.TclFallback |= bit;
+                       transition_to_swtnl( ctx );
+               } else
+                       rmesa->radeon.TclFallback |= bit;
+       } else {
+               if (oldfallback == bit) {
+                       /* We have to flush before transition */
+                       if ( rmesa->radeon.dma.flush )
+                               rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
+
+                       if (R200_DEBUG & RADEON_FALLBACKS)
+                               fprintf(stderr, "R200 end tcl fallback %s\n",
+                                               getFallbackString( bit ));
+                       rmesa->radeon.TclFallback &= ~bit;
+                       transition_to_hwtnl( ctx );
+               } else
+                       rmesa->radeon.TclFallback &= ~bit;
+       }
 }