From b0bba038467a0b22618be105010b7b3b3859b4e5 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 11 Apr 2007 08:11:52 -0600 Subject: use _mesa_reference_renderbuffer(), fix typo --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index 87ef22f52f..349912ffec 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -520,7 +520,7 @@ intel_framebuffer_renderbuffer(GLcontext * ctx, /** * When glFramebufferTexture[123]D is called this function sets up the - * gl_renderbuffer wrapp around the texture image. + * gl_renderbuffer wrapper around the texture image. * This will have the region info needed for hardware rendering. */ static struct intel_renderbuffer * @@ -606,7 +606,7 @@ intel_render_texture(GLcontext * ctx, irb = intel_wrap_texture(ctx, newImage); if (irb) { /* bind the wrapper to the attachment point */ - att->Renderbuffer = &irb->Base; + _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base); } else { /* fallback to software rendering */ -- cgit v1.2.3 From da56df9d722a2eb8223434d130436bcb6ea47188 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 16 Apr 2007 16:04:12 +0200 Subject: Make sure we are locked when creating drm buffer objects. Don't place buffer objects on unfenced list when newly created. Fix a buffer object wait-for-idle deadlock. --- src/mesa/drivers/dri/common/dri_bufmgr.c | 12 +++++++++--- src/mesa/drivers/dri/common/dri_drmpool.c | 2 +- src/mesa/drivers/dri/i915tex/intel_batchpool.c | 2 +- src/mesa/drivers/dri/i915tex/intel_buffer_objects.c | 4 ++++ src/mesa/drivers/dri/i915tex/intel_regions.c | 8 ++++++++ src/mesa/drivers/dri/i915tex/intel_screen.c | 14 ++++++++++++++ 6 files changed, 37 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 65d6545965..eaa4fb09c7 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -190,11 +190,16 @@ driBOKernel(struct _DriBufferObject *buf) void driBOWaitIdle(struct _DriBufferObject *buf, int lazy) { - assert(buf->private != NULL); + struct _DriBufferPool *pool; + void *priv; _glthread_LOCK_MUTEX(buf->mutex); - BM_CKFATAL(buf->pool->waitIdle(buf->pool, buf->private, lazy)); + pool = buf->pool; + priv = buf->private; _glthread_UNLOCK_MUTEX(buf->mutex); + + assert(priv != NULL); + BM_CKFATAL(buf->pool->waitIdle(pool, priv, lazy)); } void * @@ -296,7 +301,8 @@ driBOData(struct _DriBufferObject *buf, pool->destroy(pool, buf->private); if (!flags) flags = buf->flags; - buf->private = pool->create(pool, size, flags, 0, buf->alignment); + buf->private = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE, + buf->alignment); if (!buf->private) BM_CKFATAL(-ENOMEM); BM_CKFATAL(pool->map(pool, buf->private, diff --git a/src/mesa/drivers/dri/common/dri_drmpool.c b/src/mesa/drivers/dri/common/dri_drmpool.c index b5b324be50..878a148b39 100644 --- a/src/mesa/drivers/dri/common/dri_drmpool.c +++ b/src/mesa/drivers/dri/common/dri_drmpool.c @@ -185,7 +185,7 @@ pool_setstatic(struct _DriBufferPool *pool, unsigned long offset, return NULL; ret = drmBOCreate(pool->fd, offset, size, 0, NULL, drm_bo_type_fake, - flags, 0, buf); + flags, DRM_BO_HINT_DONT_FENCE, buf); if (ret) { free(buf); diff --git a/src/mesa/drivers/dri/i915tex/intel_batchpool.c b/src/mesa/drivers/dri/i915tex/intel_batchpool.c index 3c17c50204..2503b8a62a 100644 --- a/src/mesa/drivers/dri/i915tex/intel_batchpool.c +++ b/src/mesa/drivers/dri/i915tex/intel_batchpool.c @@ -96,7 +96,7 @@ createBPool(int fd, unsigned long bufSize, unsigned numBufs, unsigned flags, _glthread_INIT_MUTEX(p->mutex); if (drmBOCreate(fd, 0, numBufs * bufSize, 0, NULL, drm_bo_type_dc, - flags, 0, &p->kernelBO)) { + flags, DRM_BO_HINT_DONT_FENCE, &p->kernelBO)) { free(p->bufs); free(p); return NULL; diff --git a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c index ba3c7f0c1f..91c45ad95b 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c @@ -76,7 +76,9 @@ intel_bufferobj_release_region(struct intel_context *intel, */ driGenBuffers(intel->intelScreen->regionPool, "buffer object", 1, &intel_obj->buffer, 64, 0, 0); + LOCK_HARDWARE(intel); driBOData(intel_obj->buffer, intel_obj->Base.Size, NULL, 0); + UNLOCK_HARDWARE(intel); } /* Break the COW tie to the region. Both the pbo and the region end @@ -137,7 +139,9 @@ intel_bufferobj_data(GLcontext * ctx, if (intel_obj->region) intel_bufferobj_release_region(intel, intel_obj); + LOCK_HARDWARE(intel); driBOData(intel_obj->buffer, size, data, 0); + UNLOCK_HARDWARE(intel); } diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c index a114bdf896..7d19bd07d3 100644 --- a/src/mesa/drivers/dri/i915tex/intel_regions.c +++ b/src/mesa/drivers/dri/i915tex/intel_regions.c @@ -90,6 +90,7 @@ intel_region_alloc(intelScreenPrivate *intelScreen, GLuint cpp, GLuint pitch, GLuint height) { struct intel_region *region = calloc(sizeof(*region), 1); + struct intel_context *intel = intelScreenContext(intelScreen); DBG("%s\n", __FUNCTION__); @@ -107,7 +108,9 @@ intel_region_alloc(intelScreenPrivate *intelScreen, 0, #endif 0); + LOCK_HARDWARE(intel); driBOData(region->buffer, pitch * cpp * height, NULL, 0); + UNLOCK_HARDWARE(intel); return region; } @@ -392,6 +395,8 @@ void intel_region_release_pbo(intelScreenPrivate *intelScreen, struct intel_region *region) { + struct intel_context *intel = intelScreenContext(intelScreen); + assert(region->buffer == region->pbo->buffer); region->pbo->region = NULL; region->pbo = NULL; @@ -400,8 +405,11 @@ intel_region_release_pbo(intelScreenPrivate *intelScreen, driGenBuffers(intelScreen->regionPool, "region", 1, ®ion->buffer, 64, 0, 0); + + LOCK_HARDWARE(intel); driBOData(region->buffer, region->cpp * region->pitch * region->height, NULL, 0); + UNLOCK_HARDWARE(intel); } /* Break the COW tie to the pbo. Both the pbo and the region end up diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index 9034ee1b22..87a5aeb17c 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -878,9 +878,19 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 7, 0 }; + int tmpContextID; + GLuint tmpContext; dri_interface = interface; + if (!(*dri_interface->createContext)(dpy, modes->screen, + modes->fbconfigID, + &tmpContextID, &tmpContext)) { + fprintf(stderr, "Could not create temporary context.\n"); + return NULL; + } + DRM_LIGHT_LOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); + if (!driCheckDriDdxDrmVersions2("i915", dri_version, &dri_expected, ddx_version, &ddx_expected, @@ -892,6 +902,10 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); + + DRM_UNLOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); + (void) (*dri_interface->destroyContext)(dpy, modes->screen, tmpContextID); + if (psp != NULL) { I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; *driver_modes = intelFillInModes(dri_priv->cpp * 8, -- cgit v1.2.3 From 96e05da1c959b3dad7250ccfad1bf540bbec2fbf Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 16 Apr 2007 15:15:23 -0600 Subject: remove _tnl_arb_vertex_program_stage --- src/mesa/drivers/dri/i915/intel_context.c | 1 - src/mesa/drivers/dri/i915tex/intel_context.c | 1 - src/mesa/drivers/dri/mga/mga_xmesa.c | 1 - src/mesa/drivers/dri/r200/r200_context.c | 1 - src/mesa/drivers/dri/r300/r300_context.c | 1 - src/mesa/drivers/dri/tdfx/tdfx_context.c | 6 ------ 6 files changed, 11 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index d201fcf323..e1e7cdb723 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -196,7 +196,6 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = { &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, - &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, #if 1 &_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */ diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index 6a3456e154..c6c66e26ca 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -209,7 +209,6 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = { &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, - &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, #if 1 &_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 5b65d1a302..f4e651afa0 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -372,7 +372,6 @@ static const struct tnl_pipeline_stage *mga_pipeline[] = { &_tnl_fog_coordinate_stage, &_tnl_texgen_stage, &_tnl_texture_transform_stage, - &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, /* REMOVE: point attenuation stage */ diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 3abcdf9e18..0507eb86e6 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -192,7 +192,6 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = { &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, - &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, /* Try again to go to tcl? * - no good for asymmetric-twoside (do with multipass) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 1f8d95078f..58350fe0ab 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -148,7 +148,6 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = { &_tnl_fog_coordinate_stage, &_tnl_texgen_stage, &_tnl_texture_transform_stage, - &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, /* Try again to go to tcl? diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index a9163f49a8..b4eea2566f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -165,12 +165,6 @@ static const struct tnl_pipeline_stage *tdfx_pipeline[] = { &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, -#if 0 -#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program) - &_tnl_arb_vertex_program_stage, - &_tnl_vertex_program_stage, -#endif -#endif &_tnl_render_stage, 0, }; -- cgit v1.2.3 From 4a7c45118d5f122a4550f259424b6820fe3945eb Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 16 Apr 2007 17:36:39 -0600 Subject: just clean-ups --- src/mesa/drivers/dri/i915/i915_state.c | 47 +++++++++++++------------- src/mesa/drivers/dri/i915tex/i915_state.c | 56 +++++++++++++------------------ 2 files changed, 48 insertions(+), 55 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 5e00e6597b..0d5ca32969 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -541,17 +541,19 @@ void i915_update_fog( GLcontext *ctx ) else { enabled = ctx->Fog.Enabled; mode = ctx->Fog.Mode; - - try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT && - ctx->Hint.Fog == GL_NICEST && - 0); /* XXX - DISABLE -- Need ortho fallback */ +#if 0 + /* XXX - DISABLED -- Need ortho fallback */ + try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT + &&ctx->Hint.Fog == GL_NICEST); +#else + try_pixel_fog = 0; +#endif } if (!enabled) { i915->vertex_fog = I915_FOG_NONE; } else if (try_pixel_fog) { - I915_STATECHANGE(i915, I915_UPLOAD_FOG); i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK; i915->vertex_fog = I915_FOG_PIXEL; @@ -567,8 +569,8 @@ void i915_update_fog( GLcontext *ctx ) i915->vertex_fog = I915_FOG_VERTEX; } else { - GLfloat c1 = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start); - GLfloat c2 = 1.0/(ctx->Fog.End-ctx->Fog.Start); + GLfloat c2 = 1.0 / (ctx->Fog.End - ctx->Fog.Start); + GLfloat c1 = ctx->Fog.End * c2; i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK; i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR; @@ -576,10 +578,11 @@ void i915_update_fog( GLcontext *ctx ) ((GLuint)(c1 * FMC1_C1_ONE)) & FMC1_C1_MASK; if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) { - i915->state.Fog[I915_FOGREG_MODE2] = (GLuint)(c2 * FMC2_C2_ONE); + i915->state.Fog[I915_FOGREG_MODE2] + = (GLuint)(c2 * FMC2_C2_ONE); } else { - union { float f; int i; } fi; + fi_type fi; fi.f = c2; i915->state.Fog[I915_FOGREG_MODE2] = fi.i; } @@ -602,24 +605,22 @@ void i915_update_fog( GLcontext *ctx ) i915->vertex_fog = I915_FOG_VERTEX; } - { - I915_STATECHANGE(i915, I915_UPLOAD_CTX); - I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled); - if (enabled) - i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE; - else - i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE; - } + I915_STATECHANGE(i915, I915_UPLOAD_CTX); + I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled); + if (enabled) + i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE; + else + i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE; - /* always enbale pixel fog - * vertex fog use precaculted fog coord will conflict with appended - * fog program + /* Always enable pixel fog. Vertex fog using fog coord will conflict + * with fog code appended onto fragment program. */ _tnl_allow_vertex_fog( ctx, 0 ); _tnl_allow_pixel_fog( ctx, 1 ); } -static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void +i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) { i915ContextPtr i915 = I915_CONTEXT(ctx); @@ -634,8 +635,8 @@ static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) I915_STATECHANGE(i915, I915_UPLOAD_FOG); if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) { - i915->state.Fog[I915_FOGREG_MODE3] = (GLuint)(ctx->Fog.Density * - FMC3_D_ONE); + i915->state.Fog[I915_FOGREG_MODE3] + = (GLuint)(ctx->Fog.Density * FMC3_D_ONE); } else { union { float f; int i; } fi; diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c index 1fafadced0..d3217fa0ca 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state.c +++ b/src/mesa/drivers/dri/i915tex/i915_state.c @@ -563,7 +563,6 @@ i915_update_fog(GLcontext * ctx) if (ctx->FragmentProgram._Active) { /* Pull in static fog state from program */ - mode = ctx->FragmentProgram._Current->FogOption; enabled = (mode != GL_NONE); try_pixel_fog = 0; @@ -571,15 +570,19 @@ i915_update_fog(GLcontext * ctx) else { enabled = ctx->Fog.Enabled; mode = ctx->Fog.Mode; - - try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT && ctx->Hint.Fog == GL_NICEST && 0); /* XXX - DISABLE -- Need ortho fallback */ +#if 0 + /* XXX - DISABLED -- Need ortho fallback */ + try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT + && ctx->Hint.Fog == GL_NICEST); +#else + try_pixel_fog = 0; +#endif } if (!enabled) { i915->vertex_fog = I915_FOG_NONE; } else if (try_pixel_fog) { - I915_STATECHANGE(i915, I915_UPLOAD_FOG); i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK; i915->vertex_fog = I915_FOG_PIXEL; @@ -591,12 +594,13 @@ i915_update_fog(GLcontext * ctx) * either fallback or append fog instructions to end of * program in the case of linear fog. */ + printf("vertex fog!\n"); i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX; i915->vertex_fog = I915_FOG_VERTEX; } else { - GLfloat c1 = ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start); GLfloat c2 = 1.0 / (ctx->Fog.End - ctx->Fog.Start); + GLfloat c1 = ctx->Fog.End * c2; i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK; i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR; @@ -604,15 +608,11 @@ i915_update_fog(GLcontext * ctx) ((GLuint) (c1 * FMC1_C1_ONE)) & FMC1_C1_MASK; if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) { - i915->state.Fog[I915_FOGREG_MODE2] = - (GLuint) (c2 * FMC2_C2_ONE); + i915->state.Fog[I915_FOGREG_MODE2] + = (GLuint) (c2 * FMC2_C2_ONE); } else { - union - { - float f; - int i; - } fi; + fi_type fi; fi.f = c2; i915->state.Fog[I915_FOGREG_MODE2] = fi.i; } @@ -628,26 +628,22 @@ i915_update_fog(GLcontext * ctx) break; } } - else { /* if (i915->vertex_fog != I915_FOG_VERTEX) */ - + else { /* if (i915->vertex_fog != I915_FOG_VERTEX) */ I915_STATECHANGE(i915, I915_UPLOAD_FOG); i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK; i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX; i915->vertex_fog = I915_FOG_VERTEX; } - { - I915_STATECHANGE(i915, I915_UPLOAD_CTX); - I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled); - if (enabled) - i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE; - else - i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE; - } + I915_STATECHANGE(i915, I915_UPLOAD_CTX); + I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled); + if (enabled) + i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE; + else + i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE; - /* always enbale pixel fog - * vertex fog use precaculted fog coord will conflict with appended - * fog program + /* Always enable pixel fog. Vertex fog using fog coord will conflict + * with fog code appended onto fragment program. */ _tnl_allow_vertex_fog( ctx, 0 ); _tnl_allow_pixel_fog( ctx, 1 ); @@ -669,15 +665,11 @@ i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) I915_STATECHANGE(i915, I915_UPLOAD_FOG); if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) { - i915->state.Fog[I915_FOGREG_MODE3] = (GLuint) (ctx->Fog.Density * - FMC3_D_ONE); + i915->state.Fog[I915_FOGREG_MODE3] = + (GLuint) (ctx->Fog.Density * FMC3_D_ONE); } else { - union - { - float f; - int i; - } fi; + fi_type fi; fi.f = ctx->Fog.Density; i915->state.Fog[I915_FOGREG_MODE3] = fi.i; } -- cgit v1.2.3 From 1a9483c95492bee3fbda131181945b6c878bf52f Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Apr 2007 15:21:54 +0200 Subject: Defer buffer pool creation to the first context creation. This way we have a hw context so that we can take the hardware lock. Also, at this point, AIGLX isn't locked with the X server context as it is at screen creation. --- src/mesa/drivers/dri/i915tex/intel_context.c | 8 +++ src/mesa/drivers/dri/i915tex/intel_screen.c | 87 ++++++++++++++-------------- src/mesa/drivers/dri/i915tex/intel_screen.h | 3 + 3 files changed, 55 insertions(+), 43 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index c6c66e26ca..20b2b41ef2 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -346,7 +346,15 @@ intelInitContext(struct intel_context *intel, drmI830Sarea *saPriv = (drmI830Sarea *) (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset); int fthrottle_mode; + GLboolean havePools; + DRM_LIGHT_LOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext); + havePools = intelCreatePools(intelScreen); + DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext); + + if (!havePools) + return GL_FALSE; + if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, functions, (void *) intel)) diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index 87a5aeb17c..dd01161b5b 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -386,6 +386,45 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +GLboolean +intelCreatePools(intelScreenPrivate *intelScreen) +{ + unsigned batchPoolSize = 1024*1024; + __DRIscreenPrivate * sPriv = intelScreen->driScrnPriv; + + if (intelScreen->havePools) + return GL_TRUE; + + batchPoolSize /= intelScreen->maxBatchSize; + intelScreen->regionPool = driDRMPoolInit(sPriv->fd); + + if (!intelScreen->regionPool) + return GL_FALSE; + + intelScreen->staticPool = driDRMStaticPoolInit(sPriv->fd); + + if (!intelScreen->staticPool) + return GL_FALSE; + + intelScreen->texPool = intelScreen->regionPool; + + intelScreen->batchPool = driBatchPoolInit(sPriv->fd, + DRM_BO_FLAG_EXE | + DRM_BO_FLAG_MEM_TT | + DRM_BO_FLAG_MEM_LOCAL, + intelScreen->maxBatchSize, + batchPoolSize, 5); + if (!intelScreen->batchPool) { + fprintf(stderr, "Failed to initialize batch pool - possible incorrect agpgart installed\n"); + return GL_FALSE; + } + + intel_recreate_static_regions(intelScreen); + intelScreen->havePools = GL_TRUE; + + return GL_TRUE; +} + static GLboolean intelInitDriver(__DRIscreenPrivate * sPriv) @@ -393,7 +432,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv) intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv; drmI830Sarea *sarea; - unsigned batchPoolSize = 1024*1024; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface-> @@ -426,7 +464,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv) intelScreen->deviceID = gDRIPriv->deviceID; if (intelScreen->deviceID == PCI_CHIP_I865_G) intelScreen->maxBatchSize = 4096; - batchPoolSize /= intelScreen->maxBatchSize; intelScreen->mem = gDRIPriv->mem; intelScreen->cpp = gDRIPriv->cpp; @@ -517,31 +554,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv) (*glx_enable_extension) (psc, "GLX_SGI_make_current_read"); } - intelScreen->regionPool = driDRMPoolInit(sPriv->fd); - - if (!intelScreen->regionPool) - return GL_FALSE; - - intelScreen->staticPool = driDRMStaticPoolInit(sPriv->fd); - - if (!intelScreen->staticPool) - return GL_FALSE; - - intelScreen->texPool = intelScreen->regionPool; - - intelScreen->batchPool = driBatchPoolInit(sPriv->fd, - DRM_BO_FLAG_EXE | - DRM_BO_FLAG_MEM_TT | - DRM_BO_FLAG_MEM_LOCAL, - intelScreen->maxBatchSize, - batchPoolSize, 5); - if (!intelScreen->batchPool) { - fprintf(stderr, "Failed to initialize batch pool - possible incorrect agpgart installed\n"); - return GL_FALSE; - } - - intel_recreate_static_regions(intelScreen); - return GL_TRUE; } @@ -553,9 +565,11 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) intelUnmapScreenRegions(intelScreen); - driPoolTakeDown(intelScreen->regionPool); - driPoolTakeDown(intelScreen->staticPool); - driPoolTakeDown(intelScreen->batchPool); + if (intelScreen->havePools) { + driPoolTakeDown(intelScreen->regionPool); + driPoolTakeDown(intelScreen->staticPool); + driPoolTakeDown(intelScreen->batchPool); + } FREE(intelScreen); sPriv->private = NULL; } @@ -878,19 +892,9 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 7, 0 }; - int tmpContextID; - GLuint tmpContext; dri_interface = interface; - if (!(*dri_interface->createContext)(dpy, modes->screen, - modes->fbconfigID, - &tmpContextID, &tmpContext)) { - fprintf(stderr, "Could not create temporary context.\n"); - return NULL; - } - DRM_LIGHT_LOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); - if (!driCheckDriDdxDrmVersions2("i915", dri_version, &dri_expected, ddx_version, &ddx_expected, @@ -903,9 +907,6 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); - DRM_UNLOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); - (void) (*dri_interface->destroyContext)(dpy, modes->screen, tmpContextID); - if (psp != NULL) { I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; *driver_modes = intelFillInModes(dri_priv->cpp * 8, diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.h b/src/mesa/drivers/dri/i915tex/intel_screen.h index 05e2f1f2ea..bac43aaddd 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.h +++ b/src/mesa/drivers/dri/i915tex/intel_screen.h @@ -95,6 +95,7 @@ typedef struct struct _DriBufferPool *regionPool; struct _DriBufferPool *staticPool; unsigned int maxBatchSize; + GLboolean havePools; } intelScreenPrivate; @@ -130,5 +131,7 @@ extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) extern void intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea); +extern GLboolean +intelCreatePools(intelScreenPrivate *intelScreen); #endif -- cgit v1.2.3 From 8a7f474c691dc077c081b59e30937e526400860f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 8 May 2007 10:53:43 +1000 Subject: i915/miniglx: remove unused code --- src/mesa/drivers/dri/i915tex/server/intel_dri.c | 28 ------------------------- 1 file changed, 28 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915tex/server/intel_dri.c b/src/mesa/drivers/dri/i915tex/server/intel_dri.c index 4d1ac09f64..2d425d04ac 100644 --- a/src/mesa/drivers/dri/i915tex/server/intel_dri.c +++ b/src/mesa/drivers/dri/i915tex/server/intel_dri.c @@ -895,31 +895,6 @@ I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sa } } -#if 0 -static void -I830InitTextureHeap(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) -{ - /* Start up the simple memory manager for agp space */ - drmI830MemInitHeap drmHeap; - drmHeap.region = I830_MEM_REGION_AGP; - drmHeap.start = 0; - drmHeap.size = sarea->tex_size; - - if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT_HEAP, - &drmHeap, sizeof(drmHeap))) { - fprintf(stderr, - "[drm] Failed to initialized agp heap manager\n"); - } else { - fprintf(stderr, - "[drm] Initialized kernel agp heap manager, %d\n", - sarea->tex_size); - - I830SetParam(ctx, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY, - sarea->log_tex_granularity); - } -} -#endif - static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) { @@ -943,9 +918,6 @@ I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) I830DRIMapScreenRegions(ctx, pI830, sarea); SetupDRIMM(ctx, pI830); -#if 0 - I830InitTextureHeap(ctx, pI830, sarea); -#endif if (ctx->pciDevice != PCI_CHIP_845_G && ctx->pciDevice != PCI_CHIP_I830_M) { I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); -- cgit v1.2.3 From 516259d609d1f9c598fefb38d82103211c9463db Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 9 May 2007 08:07:10 -0600 Subject: Clean-up in I830AllocVidMem(), s/int/unsigned long/ for ret variable. --- src/mesa/drivers/dri/i915/server/intel_dri.c | 27 +++++++++++++------------ src/mesa/drivers/dri/i915tex/server/intel_dri.c | 27 +++++++++++++------------ 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c index 169fdbece3..b6946b75d2 100644 --- a/src/mesa/drivers/dri/i915/server/intel_dri.c +++ b/src/mesa/drivers/dri/i915/server/intel_dri.c @@ -455,12 +455,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l } unsigned long -I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags) +I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, long size, + unsigned long alignment, int flags) { - int ret; + unsigned long ret; - if (!result) - return 0; + if (!result) + return 0; /* Make sure these are initialised. */ result->Size = 0; @@ -470,16 +472,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul return 0; } - if (pool->Free.Size < size) - return AllocFromAGP(ctx, pI830, size, alignment, result); - else - { - ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); - - if (ret==0) - return AllocFromAGP(ctx, pI830, size, alignment, result); - return ret; + if (pool->Free.Size < size) { + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + else { + ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); + if (ret == 0) + ret = AllocFromAGP(ctx, pI830, size, alignment, result); } + return ret; } static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) diff --git a/src/mesa/drivers/dri/i915tex/server/intel_dri.c b/src/mesa/drivers/dri/i915tex/server/intel_dri.c index 2d425d04ac..e49c4214ad 100644 --- a/src/mesa/drivers/dri/i915tex/server/intel_dri.c +++ b/src/mesa/drivers/dri/i915tex/server/intel_dri.c @@ -483,12 +483,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l } unsigned long -I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags) +I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, long size, + unsigned long alignment, int flags) { - int ret; + unsigned long ret; - if (!result) - return 0; + if (!result) + return 0; /* Make sure these are initialised. */ result->Size = 0; @@ -498,16 +500,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul return 0; } - if (pool->Free.Size < size) - return AllocFromAGP(ctx, pI830, size, alignment, result); - else - { - ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); - - if (ret==0) - return AllocFromAGP(ctx, pI830, size, alignment, result); - return ret; + if (pool->Free.Size < size) { + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + else { + ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); + if (ret == 0) + ret = AllocFromAGP(ctx, pI830, size, alignment, result); } + return ret; } static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) -- cgit v1.2.3