mesa: Avoid flagging _NEW_VIEWPORT on redundant viewport updates.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Sep 2014 22:13:30 +0000 (15:13 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 1 Oct 2014 08:08:26 +0000 (01:08 -0700)
Cuts the number of i965 color calculator viewport uploads by 100x
(11017983 -> 113385) in 'x11perf -gc' with Glamor in Xephyr.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/viewport.c

index 6545bf68a778f41a6ee93108107a2bb017563be0..222ae307b55258ffea1ad3082a7b7fb23231210f 100644 (file)
@@ -58,6 +58,12 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
                 ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max);
    }
 
+   if (ctx->ViewportArray[idx].X == x &&
+       ctx->ViewportArray[idx].Width == width &&
+       ctx->ViewportArray[idx].Y == y &&
+       ctx->ViewportArray[idx].Height == height)
+      return;
+
    ctx->ViewportArray[idx].X = x;
    ctx->ViewportArray[idx].Width = width;
    ctx->ViewportArray[idx].Y = y;