[Intel-gfx] [PATCH] i915: Don't overwrite i915's Viewport function from generic code.

Eric Anholt eric at anholt.net
Fri Nov 14 03:40:19 CET 2008


Instead, have i965 and i915 both call the generic function from their Viewport.
---
 src/mesa/drivers/dri/i915/intel_state.c    |    2 ++
 src/mesa/drivers/dri/i965/brw_context.c    |    2 ++
 src/mesa/drivers/dri/intel/intel_context.c |    8 +++++---
 src/mesa/drivers/dri/intel/intel_context.h |    3 +++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c
index 09aa62d..4aa43e5 100644
--- a/src/mesa/drivers/dri/i915/intel_state.c
+++ b/src/mesa/drivers/dri/i915/intel_state.c
@@ -267,6 +267,8 @@ intelViewport(GLcontext * ctx,
               GLint x, GLint y, GLsizei width, GLsizei height)
 {
    intelCalcViewport(ctx);
+
+   intel_viewport(ctx, x, y, width, height);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index e2bc08a..1d6ac2c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -71,6 +71,8 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
    brwInitFragProgFuncs( functions );
    brwInitProgFuncs( functions );
    brw_init_queryobj_functions(functions);
+
+   functions->Viewport = intel_viewport;
 }
 
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 9ac18e6..6c625b4 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -317,11 +317,13 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
    driUpdateFramebufferSize(&intel->ctx, drawable);
 }
 
-static void
+void
 intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
 {
     struct intel_context *intel = intel_context(ctx);
     __DRIcontext *driContext = intel->driContext;
+    void (*old_viewport)(GLcontext *ctx, GLint x, GLint y,
+			 GLsizei w, GLsizei h);
 
     if (!driContext->driScreenPriv->dri2.enabled)
 	return;
@@ -330,11 +332,12 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
     if (driContext->driDrawablePriv != driContext->driReadablePriv)
 	intel_update_renderbuffers(driContext, driContext->driReadablePriv);
 
+    old_viewport = ctx->Driver.Viewport;
     ctx->Driver.Viewport = NULL;
     intel->driDrawable = driContext->driDrawablePriv;
     intelWindowMoved(intel);
     intel_draw_buffer(ctx, intel->ctx.DrawBuffer);
-    ctx->Driver.Viewport = intel_viewport;
+    ctx->Driver.Viewport = old_viewport;
 }
 
 /**
@@ -544,7 +547,6 @@ intelInitDriverFunctions(struct dd_function_table *functions)
    functions->Finish = intelFinish;
    functions->GetString = intelGetString;
    functions->UpdateState = intelInvalidateState;
-   functions->Viewport = intel_viewport;
 
    functions->CopyColorTable = _swrast_CopyColorTable;
    functions->CopyColorSubTable = _swrast_CopyColorSubTable;
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 3938af4..60028f0 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -495,6 +495,9 @@ extern int intel_translate_stencil_op(GLenum op);
 extern int intel_translate_blend_factor(GLenum factor);
 extern int intel_translate_logic_op(GLenum opcode);
 
+void intel_viewport(GLcontext * ctx, GLint x, GLint y,
+		    GLsizei width, GLsizei height);
+
 void intel_update_renderbuffers(__DRIcontext *context,
 				__DRIdrawable *drawable);
 
-- 
1.5.6.5




More information about the Intel-gfx mailing list