From ff6bce552a1522160c64d10677a36a7ad6cf5f88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 30 Mar 2010 14:32:10 -0400 Subject: [PATCH] intel: Remove redundant fields from struct intel_context All these pointers are in the __DRIcontext struct, which we point to. --- src/mesa/drivers/dri/i915/i915_state.c | 2 +- src/mesa/drivers/dri/i915/intel_tris.c | 12 +++++----- src/mesa/drivers/dri/intel/intel_context.c | 26 +++++++--------------- src/mesa/drivers/dri/intel/intel_context.h | 3 --- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 7275617a6fb..91b228d52b9 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -374,7 +374,7 @@ intelCalcViewport(GLcontext * ctx) else { /* window buffer, y=0=top */ yScale = -1.0; - yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F; + yBias = ctx->DrawBuffer->Height; } m[MAT_SX] = v[MAT_SX]; diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 81c4adeaf34..9449a158dc6 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -488,9 +488,9 @@ intel_wpos_triangle(struct intel_context *intel, __memcpy(v1_wpos, v1, size); __memcpy(v2_wpos, v2, size); - v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; - v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h; - v2_wpos[1] = -v2_wpos[1] + intel->driDrawable->h; + v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; + v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height; + v2_wpos[1] = -v2_wpos[1] + intel->ctx.DrawBuffer->Height; intel_draw_triangle(intel, v0, v1, v2); @@ -509,8 +509,8 @@ intel_wpos_line(struct intel_context *intel, __memcpy(v0_wpos, v0, size); __memcpy(v1_wpos, v1, size); - v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; - v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h; + v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; + v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height; intel_draw_line(intel, v0, v1); } @@ -524,7 +524,7 @@ intel_wpos_point(struct intel_context *intel, intelVertexPtr v0) GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); __memcpy(v0_wpos, v0, size); - v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h; + v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; intel_draw_point(intel, v0); } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 5289e954dbd..176f32f3aa7 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -389,7 +389,7 @@ intel_prepare_render(struct intel_context *intel) __DRIcontext *driContext = intel->driContext; __DRIdrawable *drawable; - drawable = intel->driDrawable; + drawable = driContext->driDrawablePriv; if (drawable->dri2.stamp != driContext->dri2.draw_stamp) { if (drawable->lastStamp != drawable->dri2.stamp) intel_update_renderbuffers(driContext, drawable); @@ -397,7 +397,7 @@ intel_prepare_render(struct intel_context *intel) driContext->dri2.draw_stamp = drawable->dri2.stamp; } - drawable = intel->driReadDrawable; + drawable = driContext->driReadablePriv; if (drawable->dri2.stamp != driContext->dri2.read_stamp) { if (drawable->lastStamp != drawable->dri2.stamp) intel_update_renderbuffers(driContext, drawable); @@ -472,6 +472,7 @@ void intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) { struct intel_context *intel = intel_context(ctx); + __DRIcontext *driContext = intel->driContext; if (intel->Fallback) _swrast_flush(ctx); @@ -488,9 +489,10 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) && (screen->dri2.loader->flushFrontBuffer != NULL) && - intel->driDrawable && intel->driDrawable->loaderPrivate) { - (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable, - intel->driDrawable->loaderPrivate); + driContext->driDrawablePriv && + driContext->driDrawablePriv->loaderPrivate) { + (*screen->dri2.loader->flushFrontBuffer)(driContext->driDrawablePriv, + driContext->driDrawablePriv->loaderPrivate); /* Only clear the dirty bit if front-buffer rendering is no longer * enabled. This is done so that the dirty bit can only be set in @@ -607,7 +609,6 @@ intelInitContext(struct intel_context *intel, driContextPriv->driverPrivate = intel; intel->intelScreen = intelScreen; - intel->driScreen = sPriv; intel->driContext = driContextPriv; intel->driFd = sPriv->fd; @@ -636,8 +637,7 @@ intelInitContext(struct intel_context *intel, } driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache, - intel->driScreen->myNum, - (intel->gen >= 4) ? "i965" : "i915"); + sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915"); if (intelScreen->deviceID == PCI_CHIP_I865_G) intel->maxBatchSize = 4096; else @@ -845,14 +845,6 @@ intelDestroyContext(__DRIcontext * driContextPriv) GLboolean intelUnbindContext(__DRIcontext * driContextPriv) { - struct intel_context *intel = - (struct intel_context *) driContextPriv->driverPrivate; - - /* Deassociate the context with the drawables. - */ - intel->driDrawable = NULL; - intel->driReadDrawable = NULL; - return GL_TRUE; } @@ -881,8 +873,6 @@ intelMakeCurrent(__DRIcontext * driContextPriv, struct gl_framebuffer *fb = driDrawPriv->driverPrivate; struct gl_framebuffer *readFb = driReadPriv->driverPrivate; - intel->driReadDrawable = driReadPriv; - intel->driDrawable = driDrawPriv; driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1; driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1; intel_prepare_render(intel); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 6a68c903ee0..c4bb2bed8e0 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -243,9 +243,6 @@ struct intel_context int driFd; __DRIcontext *driContext; - __DRIdrawable *driDrawable; - __DRIdrawable *driReadDrawable; - __DRIscreen *driScreen; struct intel_screen *intelScreen; /** -- 2.30.2