summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-05-11 10:23:34 -0400
committerKristian Høgsberg <[email protected]>2010-05-11 10:23:53 -0400
commitdb2993faa0211b60efd46016de5d07110cb9777a (patch)
tree1f58a4a14639ec6310a4be5318749a8602037183
parent4258e3a2e1c3278694ed10f7fc544d2154d91a96 (diff)
intel: Drop viewport hack when we can
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c2
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h1
-rw-r--r--src/mesa/drivers/dri/i915/i830_state.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c11
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h5
7 files changed, 15 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 360c5247548..c3d1f2c4542 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -736,6 +736,8 @@ setupLoaderExtensions(__DRIscreen *psp,
psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0)
+ psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i];
}
}
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index ab6c6e57afc..e4c590b1322 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -527,6 +527,7 @@ struct __DRIscreenRec {
int enabled;
__DRIdri2LoaderExtension *loader;
__DRIimageLookupExtension *image;
+ __DRIuseInvalidateExtension *useInvalidate;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
index 3b9b3ae329e..38e524e183c 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -453,8 +453,6 @@ i830Viewport(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
-
- intel_viewport(ctx, x, y, width, height);
}
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index 91b228d52b9..26d387f383a 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -394,8 +394,6 @@ i915Viewport(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
-
- intel_viewport(ctx, x, y, width, height);
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 523a11aea33..6b04ad9ec6a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -64,8 +64,6 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
brwInitFragProgFuncs( functions );
brwInitProgFuncs( functions );
brw_init_queryobj_functions(functions);
-
- functions->Viewport = intel_viewport;
}
GLboolean brwCreateContext( int api,
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 62ae637dc61..7d83e52f640 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -438,12 +438,15 @@ intel_prepare_render(struct intel_context *intel)
intel->front_buffer_dirty = GL_TRUE;
}
-void
+static void
intel_viewport(GLcontext *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);
+
if (!intel->using_dri2_swapbuffers &&
!intel->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) {
dri2InvalidateDrawable(driContext->driDrawablePriv);
@@ -608,6 +611,12 @@ intelInitContext(struct intel_context *intel,
if (intelScreen->bufmgr == NULL)
return GL_FALSE;
+ /* Can't rely on invalidate events, fall back to glViewport hack */
+ if (!driContextPriv->driScreenPriv->dri2.useInvalidate) {
+ intel->saved_viewport = functions->Viewport;
+ functions->Viewport = intel_viewport;
+ }
+
if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx,
functions, (void *) intel)) {
printf("%s: failed to init mesa context\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 7bc5aa5d9b1..db244e58729 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -243,6 +243,8 @@ struct intel_context
__DRIcontext *driContext;
struct intel_screen *intelScreen;
+ void (*saved_viewport)(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height);
/**
* Configuration cache
@@ -446,9 +448,6 @@ 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);
void intel_prepare_render(struct intel_context *intel);