nv50,nvc0: hold references to the framebuffer surfaces
[mesa.git] / src / gallium / drivers / nv50 / nv50_pc_print.c
index 09512ffb888288c5ab08355802deb9e1e0b278f5..dabbb836aa4f146dcd752cd14fd4d9e469396d70 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
 
 #include "nv50_context.h"
 #include "nv50_pc.h"
@@ -38,7 +59,7 @@ static const char *nv_opcode_names[NV_OP_COUNT + 1] = {
    "shl",
    "shr",
    "rcp",
-   "(undefined)",
+   "undef",
    "rsqrt",
    "lg2",
    "sin",
@@ -74,13 +95,16 @@ static const char *nv_opcode_names[NV_OP_COUNT + 1] = {
    "nop",
    "select",
    "export",
+   "join",
+   "round",
    "BAD_OP"
 };
 
 static const char *nv_cond_names[] =
 {
    "never", "lt" , "eq" , "le" , "gt" , "ne" , "ge" , "",
-   "never", "ltu", "equ", "leu", "gtu", "neu", "geu", ""
+   "never", "ltu", "equ", "leu", "gtu", "neu", "geu", "",
+   "o", "c", "a", "s"
 };
 
 static const char *nv_modifier_strings[] =
@@ -122,7 +146,7 @@ nv_type_name(ubyte type)
 static INLINE const char *
 nv_cond_name(ubyte cc)
 {
-   return nv_cond_names[MIN2(cc, 15)];
+   return nv_cond_names[MIN2(cc, 19)];
 }
 
 static INLINE const char *
@@ -148,21 +172,25 @@ nv_value_allocated(struct nv_value *value)
 static INLINE void
 nv_print_address(const char c, int buf, struct nv_value *a, int offset)
 {
+   const char ac =  (a && nv_value_allocated(a)) ? '$' : '%';
+
    if (buf >= 0)
       PRINT(" %s%c%i[", cyan, c, buf);
    else
       PRINT(" %s%c[", cyan, c);
    if (a)
-      PRINT("%s$a%i%s+", mgta, nv_value_id(a), cyan);
+      PRINT("%s%ca%i%s+", mgta, ac, nv_value_id(a), cyan);
    PRINT("%s0x%x%s]", orng, offset, cyan);
 }
 
 static INLINE void
 nv_print_cond(struct nv_instruction *nvi)
 {
-   PRINT("%s%s%s$c%i ",
+   char pfx = nv_value_allocated(nvi->flags_src->value->join) ? '$' : '%';
+
+   PRINT("%s%s %s%cc%i ",
          gree, nv_cond_name(nvi->cc),
-         mgta, nv_value_id(nvi->flags_src->value));
+         mgta, pfx, nv_value_id(nvi->flags_src->value));
 }
 
 static INLINE void
@@ -176,7 +204,7 @@ nv_print_value(struct nv_value *value, struct nv_value *ind, ubyte type)
    if (value->reg.file != NV_FILE_FLAGS)
       PRINT(" %s%s", gree, nv_type_name(type));
 
-   if (!nv_value_allocated(value))
+   if (!nv_value_allocated(value->join))
       reg_pfx = '%';
 
    switch (value->reg.file) {
@@ -192,6 +220,9 @@ nv_print_value(struct nv_value *value, struct nv_value *ind, ubyte type)
    case NV_FILE_FLAGS:
       PRINT(" %s%cc%i", mgta, reg_pfx, nv_value_id(value));
       break;
+   case NV_FILE_MEM_L:
+      nv_print_address('l', -1, ind, nv_value_id(value));
+      break;
    case NV_FILE_MEM_S:
       nv_print_address('s', -1, ind, 4 * nv_value_id(value));
       break;
@@ -247,6 +278,8 @@ nv_print_instruction(struct nv_instruction *i)
 {
    int j;
 
+   PRINT("%i: ", i->serial);
+
    if (i->flags_src)
       nv_print_cond(i);
 
@@ -267,6 +300,9 @@ nv_print_instruction(struct nv_instruction *i)
     */
    if (i->def[0])
       nv_print_value(i->def[0], NULL, NV_TYPE_ANY);
+   else
+   if (i->target)
+      PRINT(" %s(BB:%i)", orng, i->target->id);
    else
       PRINT(" #");
 
@@ -275,13 +311,11 @@ nv_print_instruction(struct nv_instruction *i)
          continue;
 
       if (i->src[j]->mod)
-         PRINT(" %s", nv_modifier_string(i->src[j]->mod));
+         PRINT(" %s%s", gree, nv_modifier_string(i->src[j]->mod));
 
       nv_print_ref(i->src[j],
                    (j == nv50_indirect_opnd(i)) ?
                    i->src[4]->value : NULL);
    }
-   if (!i->is_long)
-      PRINT(" %ss", norm);
-   PRINT("\n");
+   PRINT(" %s%c\n", norm, i->is_long ? 'l' : 's');
 }