i915: Only call CalcViewport from DrawBuffers instead of Viewport.
authorEric Anholt <eric@anholt.net>
Fri, 30 Jan 2009 00:45:08 +0000 (16:45 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 30 Jan 2009 21:46:37 +0000 (13:46 -0800)
This saves an inadvertent round-trip to the X Server on DrawBuffers, which was
hurting some metaops.

src/mesa/drivers/dri/i915/i915_state.c
src/mesa/drivers/dri/intel/intel_buffers.c
src/mesa/drivers/dri/intel/intel_buffers.h

index b0334d9d795d7e209f9b18e10e60c57aaeb62334..ecb763e12777f233581263e4e7945d7d5ffb8b44 100644 (file)
@@ -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);
index 13555b2e0e6ea372c9eec5c7d47be156ab37e19e..7f2144abd4b93adb55620b5503113ac98d017a3e 100644 (file)
@@ -284,14 +284,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)
index 97ae8bf738f7f0c5674aa2302e4fb8cf599cf266..6069d38e9eb7de88deb20f5a3b6e6ebcb183c2c6 100644 (file)
@@ -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 */