From: Ian Romanick Date: Fri, 1 Nov 2013 18:38:25 +0000 (-0700) Subject: i915: Bring sanity to the Viewport function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=619a9bee7da9f3b8271841b6782dfc846dd7ee32;p=mesa.git i915: Bring sanity to the Viewport function The i830 and the i915 driver have the same dd_function_table::Viewport function... it just has two names and lives in two places. Using a single implementation allows cleaning up the saved_viewport nonsense too. Signed-off-by: Ian Romanick Reviewed-by: Jordan Justen Cc: Courtney Goeltzenleuchter --- diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index cedc58a2d1c..bbf0cefe148 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -451,15 +451,6 @@ i830DepthMask(struct gl_context * ctx, GLboolean flag) i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE; } -/** Called from ctx->Driver.Viewport() */ -static void -i830Viewport(struct gl_context * ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - intelCalcViewport(ctx); -} - - /** Called from ctx->Driver.DepthRange() */ static void i830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) @@ -1136,7 +1127,6 @@ i830InitStateFuncs(struct dd_function_table *functions) functions->StencilMaskSeparate = i830StencilMaskSeparate; functions->StencilOpSeparate = i830StencilOpSeparate; functions->DepthRange = i830DepthRange; - functions->Viewport = i830Viewport; } void diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 2fd0bf12f93..fedafece6af 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -424,15 +424,6 @@ intelCalcViewport(struct gl_context * ctx) } -/** Called from ctx->Driver.Viewport() */ -static void -i915Viewport(struct gl_context * ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - intelCalcViewport(ctx); -} - - /** Called from ctx->Driver.DepthRange() */ static void i915DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) @@ -1091,7 +1082,6 @@ i915InitStateFunctions(struct dd_function_table *functions) functions->StencilMaskSeparate = i915StencilMaskSeparate; functions->StencilOpSeparate = i915StencilOpSeparate; functions->DepthRange = i915DepthRange; - functions->Viewport = i915Viewport; } diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 2748514b248..15d40748bcb 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -248,13 +248,18 @@ intel_prepare_render(struct intel_context *intel) } static void -intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +intel_noninvalidate_viewport(struct gl_context *ctx, GLint x, GLint y, + GLsizei w, GLsizei h) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; - if (intel->saved_viewport) - intel->saved_viewport(ctx, x, y, w, h); + (void) x; + (void) y; + (void) w; + (void) h; + + intelCalcViewport(ctx); if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { dri2InvalidateDrawable(driContext->driDrawablePriv); @@ -262,6 +267,17 @@ intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) } } +static void +intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + (void) x; + (void) y; + (void) w; + (void) h; + + intelCalcViewport(ctx); +} + static const struct dri_debug_control debug_control[] = { { "tex", DEBUG_TEXTURE}, { "state", DEBUG_STATE}, @@ -384,10 +400,10 @@ intelInitContext(struct intel_context *intel, struct gl_config visual; /* Can't rely on invalidate events, fall back to glViewport hack */ - if (!driContextPriv->driScreenPriv->dri2.useInvalidate) { - intel->saved_viewport = functions->Viewport; + if (!driContextPriv->driScreenPriv->dri2.useInvalidate) + functions->Viewport = intel_noninvalidate_viewport; + else functions->Viewport = intel_viewport; - } if (mesaVis == NULL) { memset(&visual, 0, sizeof visual); diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index 6fb73fcd0dc..0b83a3ef656 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -278,8 +278,6 @@ struct intel_context __DRIcontext *driContext; struct intel_screen *intelScreen; - void (*saved_viewport)(struct gl_context * ctx, - GLint x, GLint y, GLsizei width, GLsizei height); /** * Configuration cache