summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-01-29 16:45:08 -0800
committerIan Romanick <ian.d.romanick@intel.com>2009-03-13 17:38:38 -0700
commite9f37831698846bbd960b9eac07b0e520d64f799 (patch)
tree34d69d75dd3ebaf6788f842305ea1e865e820b07
parente41780fedc2c1f22b43118da30a0103fa68b769f (diff)
i915: Only call CalcViewport from DrawBuffers instead of Viewport.
This saves an inadvertent round-trip to the X Server on DrawBuffers, which was hurting some metaops. (cherry picked from commit ac0dfbdf0f5e5dea08ec717ae8c4e1e141b15c05)
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c12
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.h3
3 files changed, 10 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index f94de41a57..8347debda2 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -41,6 +41,7 @@
#include "intel_fbo.h"
#include "intel_screen.h"
#include "intel_batchbuffer.h"
+#include "intel_buffers.h"
#include "i915_context.h"
#include "i915_reg.h"
@@ -309,7 +310,7 @@ i915DepthMask(GLcontext * ctx, GLboolean flag)
* - depthrange
* - window pos/size or FBO size
*/
-static void
+void
intelCalcViewport(GLcontext * ctx)
{
struct intel_context *intel = intel_context(ctx);
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 689252221b..f1908cbc69 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -306,13 +306,11 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
fb->_NumColorDrawBuffers);
/* update viewport since it depends on window size */
- if (ctx->Driver.Viewport) {
- ctx->Driver.Viewport(ctx, ctx->Viewport.X, ctx->Viewport.Y,
- ctx->Viewport.Width, ctx->Viewport.Height);
- } else {
- ctx->NewState |= _NEW_VIEWPORT;
- }
-
+#ifdef I915
+ intelCalcViewport(ctx);
+#else
+ ctx->NewState |= _NEW_VIEWPORT;
+#endif
/* Set state we know depends on drawable parameters:
*/
if (ctx->Driver.Scissor)
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h
index 97ae8bf738..6069d38e9e 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.h
+++ b/src/mesa/drivers/dri/intel/intel_buffers.h
@@ -53,5 +53,8 @@ void intel_get_cliprects(struct intel_context *intel,
struct drm_clip_rect **cliprects,
unsigned int *num_cliprects,
int *x_off, int *y_off);
+#ifdef I915
+void intelCalcViewport(GLcontext * ctx);
+#endif
#endif /* INTEL_BUFFERS_H */