radeon/r200: drop legacy texture heap code
[mesa.git] / src / mesa / drivers / dri / r200 / r200_context.c
index 1f5a9f2427b8a0a0b2d8454d65c83af8647e4927..a744469b31ce5168befc299f86d74df41a154227 100644 (file)
@@ -63,14 +63,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "radeon_span.h"
 
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
 #define need_GL_ARB_vertex_program
 #define need_GL_ATI_fragment_shader
 #define need_GL_EXT_blend_minmax
 #define need_GL_EXT_fog_coord
-#define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_blend_equation_separate
 #define need_GL_EXT_blend_func_separate
@@ -118,20 +114,16 @@ static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
  */
 const struct dri_extension card_extensions[] =
 {
-    { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_multitexture",               NULL },
     { "GL_ARB_texture_border_clamp",       NULL },
-    { "GL_ARB_texture_compression",        GL_ARB_texture_compression_functions },
     { "GL_ARB_texture_env_add",            NULL },
     { "GL_ARB_texture_env_combine",        NULL },
     { "GL_ARB_texture_env_dot3",           NULL },
     { "GL_ARB_texture_env_crossbar",       NULL },
     { "GL_ARB_texture_mirrored_repeat",    NULL },
-    { "GL_ARB_vertex_buffer_object",       GL_ARB_vertex_buffer_object_functions },
     { "GL_EXT_blend_minmax",               GL_EXT_blend_minmax_functions },
     { "GL_EXT_blend_subtract",             NULL },
     { "GL_EXT_fog_coord",                  GL_EXT_fog_coord_functions },
-    { "GL_EXT_multi_draw_arrays",          GL_EXT_multi_draw_arrays_functions },
     { "GL_EXT_secondary_color",            GL_EXT_secondary_color_functions },
     { "GL_EXT_stencil_wrap",               NULL },
     { "GL_EXT_texture_edge_clamp",         NULL },
@@ -254,11 +246,10 @@ static void r200_get_lock(radeonContextPtr radeon)
 
    if ( sarea->ctx_owner != rmesa->radeon.dri.hwContext ) {
       sarea->ctx_owner = rmesa->radeon.dri.hwContext;
+      if (!radeon->radeonScreen->kernel_mm)
+         radeon_bo_legacy_texture_age(radeon->radeonScreen->bom);
    }
 
-   for ( i = 0 ; i < rmesa->radeon.nr_heaps ; i++ ) {
-      DRI_AGE_TEXTURES( rmesa->radeon.texture_heaps[ i ] );
-   }
 }
 
 static void r200_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
@@ -340,25 +331,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
      return GL_FALSE;
    }
 
-
-   (void) memset( rmesa->radeon.texture_heaps, 0, sizeof( rmesa->radeon.texture_heaps ) );
-   make_empty_list( & rmesa->radeon.swapped );
-
-   rmesa->radeon.nr_heaps = 1 /* screen->numTexHeaps */ ;
-   assert(rmesa->radeon.nr_heaps < RADEON_NR_TEX_HEAPS);
-#if 0
-   for ( i = 0 ; i < rmesa->radeon.nr_heaps ; i++ ) {
-      rmesa->radeon.texture_heaps[i] = driCreateTextureHeap( i, rmesa,
-           screen->texSize[i],
-           12,
-           RADEON_NR_TEX_REGIONS,
-           (drmTextureRegionPtr)rmesa->radeon.sarea->tex_list[i],
-           & rmesa->radeon.sarea->tex_age[i],
-           & rmesa->radeon.swapped,
-           sizeof( radeonTexObj ),
-           (destroy_texture_object_t *) r200DestroyTexObj );
-   }
-#endif
    rmesa->radeon.texture_depth = driQueryOptioni (&rmesa->radeon.optionCache,
                                           "texture_depth");
    if (rmesa->radeon.texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
@@ -382,22 +354,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
 
    i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures");
 
-   driCalculateMaxTextureLevels( rmesa->radeon.texture_heaps,
-                                rmesa->radeon.nr_heaps,
-                                & ctx->Const,
-                                4,
-                                11, /* max 2D texture size is 2048x2048 */
-#if ENABLE_HW_3D_TEXTURE
-                                8,  /* max 3D texture size is 256^3 */
-#else
-                                0,  /* 3D textures unsupported */
-#endif
-                                11, /* max cube texture size is 2048x2048 */
-                                11, /* max texture rectangle size is 2048x2048 */
-                                12,
-                                GL_FALSE,
-                                i );
-
    ctx->Const.MaxTextureMaxAnisotropy = 16.0;
 
    /* No wide AA points.
@@ -426,6 +382,8 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
    ctx->Const.VertexProgram.MaxNativeParameters = R200_VSF_MAX_PARAM;
    ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
 
+   ctx->Const.MaxDrawBuffers = 1;
+
    /* Initialize the software rasterizer and helper modules.
     */
    _swrast_CreateContext( ctx );
@@ -548,10 +506,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
    /* Free r200 context resources */
    assert(rmesa); /* should never be null */
    if ( rmesa ) {
-      GLboolean   release_texture_heaps;
-
 
-      release_texture_heaps = (rmesa->radeon.glCtx->Shared->RefCount == 1);
       _swsetup_DestroyContext( rmesa->radeon.glCtx );
       _tnl_DestroyContext( rmesa->radeon.glCtx );
       _vbo_DestroyContext( rmesa->radeon.glCtx );
@@ -561,6 +516,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
       r200ReleaseArrays( rmesa->radeon.glCtx, ~0 );
 
       if (rmesa->radeon.dma.current) {
+        radeonReleaseDmaRegion( &rmesa->radeon );
         rcommonFlushCmdBuf( &rmesa->radeon, __FUNCTION__ );
       }
 
@@ -569,21 +525,6 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
         rmesa->radeon.state.scissor.pClipRects = NULL;
       }
 
-
-      if ( release_texture_heaps ) {
-         /* This share group is about to go away, free our private
-          * texture object data.
-          */
-         int i;
-
-         for ( i = 0 ; i < rmesa->radeon.nr_heaps ; i++ ) {
-           driDestroyTextureHeap( rmesa->radeon.texture_heaps[ i ] );
-           rmesa->radeon.texture_heaps[ i ] = NULL;
-         }
-
-        assert( is_empty_list( & rmesa->radeon.swapped ) );
-      }
-
       radeonCleanupContext(&rmesa->radeon);
 
       FREE( rmesa );