#include "drivers/common/driverfuncs.h"
+#include "radeon_common.h"
#include "radeon_context.h"
-#include "common_cmdbuf.h"
#include "radeon_ioctl.h"
#include "radeon_state.h"
#include "radeon_span.h"
#include "radeon_tcl.h"
#include "radeon_maos.h"
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_fog_coord
#define need_GL_EXT_secondary_color
+#define need_GL_EXT_framebuffer_object
#include "extension_helper.h"
#define DRIVER_DATE "20061018"
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
-/* Return various strings for glGetString().
- */
-static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
-{
- r100ContextPtr rmesa = R100_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = (rmesa->radeon.radeonScreen->card_type==RADEON_CARD_PCI) ? 0 :
- rmesa->radeon.radeonScreen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "Radeon", DRIVER_DATE,
- agp_mode );
-
- sprintf( & buffer[ offset ], " %sTCL",
- !(rmesa->radeon.TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-" );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
/* Extension strings exported by the R100 driver.
*/
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_crossbar", NULL },
{ "GL_ARB_texture_env_dot3", NULL },
{ "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
{ "GL_EXT_blend_logic_op", NULL },
{ "GL_EXT_blend_subtract", GL_EXT_blend_minmax_functions },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+ { "GL_EXT_packed_depth_stencil", NULL},
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
{ "GL_EXT_stencil_wrap", NULL },
{ "GL_EXT_texture_edge_clamp", NULL },
{ NULL, NULL }
};
+const struct dri_extension mm_extensions[] = {
+ { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
+ { NULL, NULL }
+};
+
extern const struct tnl_pipeline_stage _radeon_render_stage;
extern const struct tnl_pipeline_stage _radeon_tcl_stage;
NULL,
};
-
-
-/* Initialize the driver's misc functions.
- */
-static void radeonInitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetString = radeonGetString;
-}
-
static const struct dri_debug_control debug_control[] =
{
{ "fall", DEBUG_FALLBACKS },
}
if (sarea->ctx_owner != rmesa->radeon.dri.hwContext) {
- int i;
sarea->ctx_owner = rmesa->radeon.dri.hwContext;
- for (i = 0; i < rmesa->radeon.nr_heaps; i++) {
- DRI_AGE_TEXTURES(rmesa->radeon.texture_heaps[i]);
- }
+ if (!radeon->radeonScreen->kernel_mm)
+ radeon_bo_legacy_texture_age(radeon->radeonScreen->bom);
}
}
-static void r100_vtbl_flush(GLcontext *ctx)
-{
- RADEON_FIREVERTICES(R100_CONTEXT(ctx));
-}
-
-static void r100_vtbl_set_all_dirty(GLcontext *ctx)
-{
- r100ContextPtr rmesa = R100_CONTEXT(ctx);
- rmesa->hw.all_dirty = GL_TRUE;
-}
-
static void r100_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
{
}
-static void r100_vtbl_emit_state(radeonContextPtr rmesa)
+static void r100_vtbl_pre_emit_state(radeonContextPtr radeon)
{
- radeonEmitState((r100ContextPtr)rmesa);
-}
-
-static void r100_vtbl_flush_vertices(radeonContextPtr rmesa)
-{
- RADEON_FIREVERTICES(((r100ContextPtr)rmesa));
+ r100ContextPtr rmesa = (r100ContextPtr)radeon;
+
+ /* r100 always needs to emit ZBS to avoid TCL lockups */
+ rmesa->hw.zbs.dirty = 1;
+ radeon->hw.is_dirty = 1;
}
{
radeon->vtbl.get_lock = r100_get_lock;
radeon->vtbl.update_viewport_offset = radeonUpdateViewportOffset;
- radeon->vtbl.flush = r100_vtbl_flush;
- radeon->vtbl.set_all_dirty = r100_vtbl_set_all_dirty;
- radeon->vtbl.update_draw_buffer = radeonUpdateDrawBuffer;
radeon->vtbl.emit_cs_header = r100_vtbl_emit_cs_header;
- radeon->vtbl.emit_state = r100_vtbl_emit_state;
radeon->vtbl.swtcl_flush = r100_swtcl_flush;
- radeon->vtbl.flush_vertices = r100_vtbl_flush_vertices;
+ radeon->vtbl.pre_emit_state = r100_vtbl_pre_emit_state;
+ radeon->vtbl.fallback = radeonFallback;
}
/* Create the device specific context.
* (the texture functions are especially important)
*/
_mesa_init_driver_functions( &functions );
- radeonInitDriverFuncs( &functions );
radeonInitTextureFuncs( &functions );
if (!radeonInitContext(&rmesa->radeon, &functions,
return GL_FALSE;
}
- (void) memset( rmesa->radeon.texture_heaps, 0, sizeof( rmesa->radeon.texture_heaps ) );
- make_empty_list( & rmesa->radeon.swapped );
-
-#if 0
- rmesa->radeon.nr_heaps = screen->numTexHeaps;
- 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 *) radeonDestroyTexObj );
-
- driSetTextureSwapCounterLocation( rmesa->radeon.texture_heaps[i],
- & rmesa->c_textureSwaps );
- }
-#endif
rmesa->radeon.texture_depth = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_depth");
if (rmesa->radeon.texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
rmesa->radeon.swtcl.RenderIndex = ~0;
- rmesa->hw.all_dirty = GL_TRUE;
+ rmesa->radeon.hw.all_dirty = GL_TRUE;
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have all of them in
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 */
- 8, /* 256^3 */
- 9, /* \todo: max cube texture size seems to be 512x512(x6) */
- 11, /* max rect texture size is 2048x2048. */
- 12,
- GL_FALSE,
- i );
-
-
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
/* No wide points.
rmesa->boxes = 0;
+ ctx->Const.MaxDrawBuffers = 1;
+
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
}
driInitExtensions( ctx, card_extensions, GL_TRUE );
+ if (rmesa->radeon.radeonScreen->kernel_mm)
+ driInitExtensions(ctx, mm_extensions, GL_FALSE);
if (rmesa->radeon.radeonScreen->drmSupportsCubeMapsR100)
_mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
if (rmesa->radeon.glCtx->Mesa_DXTn) {
_mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
/* XXX these should really go right after _mesa_init_driver_functions() */
+ radeon_fbo_init(&rmesa->radeon);
+ radeonInitSpanFuncs( ctx );
radeonInitIoctlFuncs( ctx );
radeonInitStateFuncs( ctx );
- radeonInitSpanFuncs( ctx );
radeonInitState( rmesa );
radeonInitSwtcl( ctx );
rmesa->radeon.do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
- (*sPriv->systemTime->getUST)( & rmesa->radeon.swap_ust );
-
#if DO_DEBUG
RADEON_DEBUG = driParseDebugString( getenv( "RADEON_DEBUG" ),
/* check if we're deleting the currently bound context */
if (rmesa == current) {
- RADEON_FIREVERTICES( rmesa );
+ radeon_firevertices(&rmesa->radeon);
_mesa_make_current(NULL, NULL, NULL);
}
/* Free radeon 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 );
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 );
}
}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-radeonUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- r100ContextPtr rmesa = (r100ContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) rmesa->radeon.glCtx);
-
- return GL_TRUE;
-}