Mesa (master): i915g: More ops commute.

Stephane Marchesin marcheu at kemper.freedesktop.org
Sat Jun 16 03:28:38 UTC 2012


Module: Mesa
Branch: master
Commit: 841eee5d44b222a5819804726187683033eb71db
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=841eee5d44b222a5819804726187683033eb71db

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Wed Jun 13 10:00:57 2012 -0700

i915g: More ops commute.

This allows using the optimizations more broadly.

---

 src/gallium/drivers/i915/TODO                |    3 +++
 src/gallium/drivers/i915/i915_fpc_optimize.c |   25 +++++++++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
index d52c1c0..c72f09a 100644
--- a/src/gallium/drivers/i915/TODO
+++ b/src/gallium/drivers/i915/TODO
@@ -42,5 +42,8 @@ Random list of problems with i915g:
 
 - Continue a previous primitive when there are no state changes
 
+- Switch to the blitter for those buggy blit copies
+- Or state save/restore has a bug with u_blitter, fix it.
+
 Other bugs can be found here:
 https://bugs.freedesktop.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Drivers/Gallium/i915g
diff --git a/src/gallium/drivers/i915/i915_fpc_optimize.c b/src/gallium/drivers/i915/i915_fpc_optimize.c
index b09f18b..ce1c5f9 100644
--- a/src/gallium/drivers/i915/i915_fpc_optimize.c
+++ b/src/gallium/drivers/i915/i915_fpc_optimize.c
@@ -87,17 +87,30 @@ static boolean is_unswizzled(struct i915_full_src_register* r,
 
 static boolean op_commutes(unsigned opcode)
 {
-   if (opcode == TGSI_OPCODE_ADD) return TRUE;
-   if (opcode == TGSI_OPCODE_MUL) return TRUE;
+   switch(opcode)
+   {
+      case TGSI_OPCODE_ADD:
+      case TGSI_OPCODE_MUL:
+      case TGSI_OPCODE_DP2:
+      case TGSI_OPCODE_DP3:
+      case TGSI_OPCODE_DP4:
+         return TRUE;
+   }
    return FALSE;
 }
 
 static unsigned op_neutral_element(unsigned opcode)
 {
-   if (opcode == TGSI_OPCODE_ADD)
-      return TGSI_SWIZZLE_ZERO;
-   if (opcode == TGSI_OPCODE_MUL)
-      return TGSI_SWIZZLE_ONE;
+   switch(opcode)
+   {
+      case TGSI_OPCODE_ADD:
+         return TGSI_SWIZZLE_ZERO;
+      case TGSI_OPCODE_MUL:
+      case TGSI_OPCODE_DP2:
+      case TGSI_OPCODE_DP3:
+      case TGSI_OPCODE_DP4:
+         return TGSI_SWIZZLE_ONE;
+   }
 
    debug_printf("Unknown opcode %d\n",opcode);
    return TGSI_SWIZZLE_ZERO;




More information about the mesa-commit mailing list