v3d: Print CLIF fixed-point values as just their decimal value.
authorEric Anholt <eric@anholt.net>
Wed, 27 Jun 2018 22:16:05 +0000 (15:16 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 30 Jul 2018 21:29:01 +0000 (14:29 -0700)
The parser doesn't handle float input, so we have to dump the raw value.

src/broadcom/cle/v3d_decoder.c

index 084fc64..c1e9e50 100644 (file)
@@ -925,14 +925,24 @@ v3d_field_iterator_next(struct clif_dump *clif, struct v3d_field_iterator *iter)
                                              iter->field->type.v3d_struct->name);
                 break;
         case V3D_TYPE_SFIXED:
-                snprintf(iter->value, sizeof(iter->value), "%f",
-                         __gen_unpack_sfixed(iter->p, s, e,
-                                             iter->field->type.f));
+                if (clif->pretty) {
+                        snprintf(iter->value, sizeof(iter->value), "%f",
+                                 __gen_unpack_sfixed(iter->p, s, e,
+                                                     iter->field->type.f));
+                } else {
+                        snprintf(iter->value, sizeof(iter->value), "%u",
+                                 (unsigned)__gen_unpack_uint(iter->p, s, e));
+                }
                 break;
         case V3D_TYPE_UFIXED:
-                snprintf(iter->value, sizeof(iter->value), "%f",
-                         __gen_unpack_ufixed(iter->p, s, e,
-                                             iter->field->type.f));
+                if (clif->pretty) {
+                        snprintf(iter->value, sizeof(iter->value), "%f",
+                                 __gen_unpack_ufixed(iter->p, s, e,
+                                                     iter->field->type.f));
+                } else {
+                        snprintf(iter->value, sizeof(iter->value), "%u",
+                                 (unsigned)__gen_unpack_uint(iter->p, s, e));
+                }
                 break;
         case V3D_TYPE_MBO:
                 break;