[Mesa-dev] [PATCH 2/3] i915: Bring sanity to the Viewport function
Ian Romanick
idr at freedesktop.org
Fri Nov 1 12:44:19 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
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 <ian.d.romanick at intel.com>
Cc: Courtney Goeltzenleuchter <courtney at lunarg.com>
Cc: Jordan Justen <jljusten at gmail.com>
---
src/mesa/drivers/dri/i915/i830_state.c | 10 ----------
src/mesa/drivers/dri/i915/i915_state.c | 10 ----------
src/mesa/drivers/dri/i915/intel_context.c | 28 ++++++++++++++++++++++------
src/mesa/drivers/dri/i915/intel_context.h | 2 --
4 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
index cedc58a..bbf0cef 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 2fd0bf1..fedafec 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 2748514..15d4074 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 6fb73fc..0b83a3e 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
--
1.8.1.4
More information about the mesa-dev
mailing list