X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi810%2Fi810context.c;h=7311b2e76549ad9d335f23fe253c5ace6cfb3fd9;hb=006a526edb0f5a67679309a867a1af22d94e1687;hp=7db354d193f97100eb0c66659c4253e594a204d3;hpb=53f82c5aadbb15585754bfacf3237093eccdb2ce;p=mesa.git diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 7db354d193f..7311b2e7654 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -24,7 +24,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810context.c,v 1.3 2002/10/30 12:51:33 alanh Exp $ */ /* * Authors: @@ -33,17 +32,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "context.h" -#include "matrix.h" -#include "simple_list.h" -#include "extensions.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/simple_list.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/points.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" -#include "array_cache/acache.h" +#include "vbo/vbo.h" #include "tnl/t_pipeline.h" @@ -59,21 +60,40 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i810vb.h" #include "i810ioctl.h" +#include "drirenderbuffer.h" #include "utils.h" + #ifndef I810_DEBUG int I810_DEBUG = (0); #endif -const char __driConfigOptions[] = { 0 }; +PUBLIC const char __driConfigOptions[] = { 0 }; const GLuint __driNConfigOptions = 0; +#define DRIVER_DATE "20050821" + static const GLubyte *i810GetString( GLcontext *ctx, GLenum name ) { + static char buffer[128]; + switch (name) { case GL_VENDOR: return (GLubyte *)"Keith Whitwell"; - case GL_RENDERER: - return (GLubyte *)"Mesa DRI I810 20021125"; + case GL_RENDERER: { + i810ContextPtr imesa = I810_CONTEXT(ctx); + const char * chipset; + + switch (imesa->i810Screen->deviceID) { + case PCI_CHIP_I810: chipset = "i810"; break; + case PCI_CHIP_I810_DC100: chipset = "i810 DC-100"; break; + case PCI_CHIP_I810_E: chipset = "i810E"; break; + case PCI_CHIP_I815: chipset = "i815"; break; + default: chipset = "Unknown i810-class Chipset"; break; + } + + (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 ); + return (GLubyte *) buffer; + } default: return 0; } @@ -96,17 +116,22 @@ static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) /* Extension strings exported by the i810 driver. */ -static const char * const card_extensions[] = +static const struct dri_extension card_extensions[] = { - "GL_ARB_multitexture", - "GL_ARB_texture_env_add", - "GL_ARB_texture_mirrored_repeat", - "GL_EXT_stencil_wrap", - "GL_EXT_texture_edge_clamp", - "GL_EXT_texture_lod_bias", - "GL_MESA_ycbcr_texture", - "GL_SGIS_generate_mipmap", - NULL + { "GL_ARB_multitexture", NULL }, + { "GL_ARB_texture_env_add", NULL }, + { "GL_ARB_texture_env_combine", NULL }, + { "GL_ARB_texture_env_crossbar", NULL }, + { "GL_ARB_texture_mirrored_repeat", NULL }, + { "GL_EXT_stencil_wrap", NULL }, + { "GL_EXT_texture_edge_clamp", NULL }, + { "GL_EXT_texture_env_combine", NULL }, + { "GL_EXT_texture_lod_bias", NULL }, + { "GL_EXT_texture_rectangle", NULL }, + { "GL_MESA_ycbcr_texture", NULL }, + { "GL_NV_blend_square", NULL }, + { "GL_SGIS_generate_mipmap", NULL }, + { NULL, NULL } }; extern const struct tnl_pipeline_stage _i810_render_stage; @@ -230,7 +255,8 @@ i810CreateContext( const __GLcontextModes *mesaVis, 0, /* cube textures unsupported. */ 0, /* texture rectangles unsupported. */ 12, - GL_FALSE ); + GL_FALSE, + 0 ); ctx->Const.MinLineWidth = 1.0; ctx->Const.MinLineWidthAA = 1.0; @@ -244,8 +270,12 @@ i810CreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxPointSizeAA = 3.0; ctx->Const.PointSizeGranularity = 1.0; + /* reinitialize the context point state. + * It depend on constants in __GLcontextRec::Const + */ + _mesa_init_point(ctx); + ctx->Driver.GetBufferSize = i810BufferSize; - ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; ctx->Driver.GetString = i810GetString; /* Who owns who? @@ -256,7 +286,7 @@ i810CreateContext( const __GLcontextModes *mesaVis, /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); - _ac_CreateContext( ctx ); + _vbo_CreateContext( ctx ); _tnl_CreateContext( ctx ); _swsetup_CreateContext( ctx ); @@ -319,7 +349,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv) release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1); _swsetup_DestroyContext( imesa->glCtx ); _tnl_DestroyContext( imesa->glCtx ); - _ac_DestroyContext( imesa->glCtx ); + _vbo_DestroyContext( imesa->glCtx ); _swrast_DestroyContext( imesa->glCtx ); i810FreeVB( imesa->glCtx ); @@ -331,7 +361,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv) /* This share group is about to go away, free our private * texture object data. */ - int i; + unsigned int i; for ( i = 0 ; i < imesa->nr_heaps ; i++ ) { driDestroyTextureHeap( imesa->texture_heaps[ i ] ); @@ -384,11 +414,12 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa ) static void i810XMesaWindowMoved( i810ContextPtr imesa ) { - switch (imesa->glCtx->Color._DrawDestMask[0]) { - case DD_FRONT_LEFT_BIT: + /* Determine current color drawing buffer */ + switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferIndexes[0]) { + case BUFFER_FRONT_LEFT: i810XMesaSetFrontClipRects( imesa ); break; - case DD_BACK_LEFT_BIT: + case BUFFER_BACK_LEFT: i810XMesaSetBackClipRects( imesa ); break; default: @@ -424,19 +455,16 @@ i810MakeCurrent(__DRIcontextPrivate *driContextPriv, */ imesa->driDrawable = driDrawPriv; - _mesa_make_current2(imesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + _mesa_make_current(imesa->glCtx, + (GLframebuffer *) driDrawPriv->driverPrivate, + (GLframebuffer *) driReadPriv->driverPrivate); /* Are these necessary? */ i810XMesaWindowMoved( imesa ); - if (!imesa->glCtx->Viewport.Width) - _mesa_set_viewport(imesa->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h); } else { - _mesa_make_current(0,0); + _mesa_make_current(NULL, NULL, NULL); } return GL_TRUE; @@ -448,11 +476,12 @@ i810UpdatePageFlipping( i810ContextPtr imesa ) GLcontext *ctx = imesa->glCtx; int front = 0; - switch (ctx->Color._DrawDestMask[0]) { - case DD_FRONT_LEFT_BIT: + /* Determine current color drawing buffer */ + switch (ctx->DrawBuffer->_ColorDrawBufferIndexes[0]) { + case BUFFER_FRONT_LEFT: front = 1; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BACK_LEFT: front = 0; break; default: @@ -461,15 +490,13 @@ i810UpdatePageFlipping( i810ContextPtr imesa ) if ( imesa->sarea->pf_current_page == 1 ) front ^= 1; + + driFlipRenderbuffers(ctx->WinSysDrawBuffer, front); if (front) { imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->fbOffset | imesa->i810Screen->backPitchBits; - imesa->drawMap = (char *)imesa->driScreen->pFB; - imesa->readMap = (char *)imesa->driScreen->pFB; } else { imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->backOffset | imesa->i810Screen->backPitchBits; - imesa->drawMap = imesa->i810Screen->back.map; - imesa->readMap = imesa->i810Screen->back.map; } imesa->dirty |= I810_UPLOAD_BUFFERS; @@ -499,6 +526,7 @@ void i810GetLock( i810ContextPtr imesa, GLuint flags ) * more broken than usual. */ if (sarea->ctxOwner != me) { + driUpdateFramebufferSize(imesa->glCtx, dPriv); imesa->upload_cliprects = GL_TRUE; imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS; if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;