diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-03-07 17:39:43 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-03-14 02:31:50 -0400 |
commit | bb9b18a390db4a15cd46bbd7472510feb7d4c168 (patch) | |
tree | c1772c7007697097c55d7396b6a1c01ad9fea397 /drivers/gpu | |
parent | 7fa0cba2b269fa498804a89a0a1d763ea1f65015 (diff) |
drm/nouveau: add nouveau_enum_find() util function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_util.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_util.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_graph.c | 92 |
3 files changed, 66 insertions, 53 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.c b/drivers/gpu/drm/nouveau/nouveau_util.c index fbe0fb13bc1e..e51b51503baa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_util.c +++ b/drivers/gpu/drm/nouveau/nouveau_util.c | |||
@@ -47,18 +47,27 @@ nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value) | |||
47 | printk(" (unknown bits 0x%08x)", value); | 47 | printk(" (unknown bits 0x%08x)", value); |
48 | } | 48 | } |
49 | 49 | ||
50 | void | 50 | const struct nouveau_enum * |
51 | nouveau_enum_print(const struct nouveau_enum *en, u32 value) | 51 | nouveau_enum_find(const struct nouveau_enum *en, u32 value) |
52 | { | 52 | { |
53 | while (en->name) { | 53 | while (en->name) { |
54 | if (value == en->value) { | 54 | if (en->value == value) |
55 | printk("%s", en->name); | 55 | return en; |
56 | return; | ||
57 | } | ||
58 | |||
59 | en++; | 56 | en++; |
60 | } | 57 | } |
61 | 58 | ||
59 | return NULL; | ||
60 | } | ||
61 | |||
62 | void | ||
63 | nouveau_enum_print(const struct nouveau_enum *en, u32 value) | ||
64 | { | ||
65 | en = nouveau_enum_find(en, value); | ||
66 | if (en) { | ||
67 | printk("%s", en->name); | ||
68 | return; | ||
69 | } | ||
70 | |||
62 | printk("(unknown enum 0x%08x)", value); | 71 | printk("(unknown enum 0x%08x)", value); |
63 | } | 72 | } |
64 | 73 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_util.h b/drivers/gpu/drm/nouveau/nouveau_util.h index d9ceaea26f4b..b97719fbb739 100644 --- a/drivers/gpu/drm/nouveau/nouveau_util.h +++ b/drivers/gpu/drm/nouveau/nouveau_util.h | |||
@@ -36,10 +36,14 @@ struct nouveau_bitfield { | |||
36 | struct nouveau_enum { | 36 | struct nouveau_enum { |
37 | u32 value; | 37 | u32 value; |
38 | const char *name; | 38 | const char *name; |
39 | void *data; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | void nouveau_bitfield_print(const struct nouveau_bitfield *, u32 value); | 42 | void nouveau_bitfield_print(const struct nouveau_bitfield *, u32 value); |
42 | void nouveau_enum_print(const struct nouveau_enum *, u32 value); | 43 | void nouveau_enum_print(const struct nouveau_enum *, u32 value); |
44 | const struct nouveau_enum * | ||
45 | nouveau_enum_find(const struct nouveau_enum *, u32 value); | ||
46 | |||
43 | int nouveau_ratelimit(void); | 47 | int nouveau_ratelimit(void); |
44 | 48 | ||
45 | #endif | 49 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index e1267a1f6d10..a8be5184477a 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -550,11 +550,11 @@ nv86_graph_tlb_flush(struct drm_device *dev) | |||
550 | 550 | ||
551 | static struct nouveau_enum nv50_mp_exec_error_names[] = | 551 | static struct nouveau_enum nv50_mp_exec_error_names[] = |
552 | { | 552 | { |
553 | { 3, "STACK_UNDERFLOW" }, | 553 | { 3, "STACK_UNDERFLOW", NULL }, |
554 | { 4, "QUADON_ACTIVE" }, | 554 | { 4, "QUADON_ACTIVE", NULL }, |
555 | { 8, "TIMEOUT" }, | 555 | { 8, "TIMEOUT", NULL }, |
556 | { 0x10, "INVALID_OPCODE" }, | 556 | { 0x10, "INVALID_OPCODE", NULL }, |
557 | { 0x40, "BREAKPOINT" }, | 557 | { 0x40, "BREAKPOINT", NULL }, |
558 | {} | 558 | {} |
559 | }; | 559 | }; |
560 | 560 | ||
@@ -582,47 +582,47 @@ static struct nouveau_bitfield nv50_graph_trap_ccache[] = { | |||
582 | 582 | ||
583 | /* There must be a *lot* of these. Will take some time to gather them up. */ | 583 | /* There must be a *lot* of these. Will take some time to gather them up. */ |
584 | struct nouveau_enum nv50_data_error_names[] = { | 584 | struct nouveau_enum nv50_data_error_names[] = { |
585 | { 0x00000003, "INVALID_QUERY_OR_TEXTURE" }, | 585 | { 0x00000003, "INVALID_QUERY_OR_TEXTURE", NULL }, |
586 | { 0x00000004, "INVALID_VALUE" }, | 586 | { 0x00000004, "INVALID_VALUE", NULL }, |
587 | { 0x00000005, "INVALID_ENUM" }, | 587 | { 0x00000005, "INVALID_ENUM", NULL }, |
588 | { 0x00000008, "INVALID_OBJECT" }, | 588 | { 0x00000008, "INVALID_OBJECT", NULL }, |
589 | { 0x00000009, "READ_ONLY_OBJECT" }, | 589 | { 0x00000009, "READ_ONLY_OBJECT", NULL }, |
590 | { 0x0000000a, "SUPERVISOR_OBJECT" }, | 590 | { 0x0000000a, "SUPERVISOR_OBJECT", NULL }, |
591 | { 0x0000000b, "INVALID_ADDRESS_ALIGNMENT" }, | 591 | { 0x0000000b, "INVALID_ADDRESS_ALIGNMENT", NULL }, |
592 | { 0x0000000c, "INVALID_BITFIELD" }, | 592 | { 0x0000000c, "INVALID_BITFIELD", NULL }, |
593 | { 0x0000000d, "BEGIN_END_ACTIVE" }, | 593 | { 0x0000000d, "BEGIN_END_ACTIVE", NULL }, |
594 | { 0x0000000e, "SEMANTIC_COLOR_BACK_OVER_LIMIT" }, | 594 | { 0x0000000e, "SEMANTIC_COLOR_BACK_OVER_LIMIT", NULL }, |
595 | { 0x0000000f, "VIEWPORT_ID_NEEDS_GP" }, | 595 | { 0x0000000f, "VIEWPORT_ID_NEEDS_GP", NULL }, |
596 | { 0x00000010, "RT_DOUBLE_BIND" }, | 596 | { 0x00000010, "RT_DOUBLE_BIND", NULL }, |
597 | { 0x00000011, "RT_TYPES_MISMATCH" }, | 597 | { 0x00000011, "RT_TYPES_MISMATCH", NULL }, |
598 | { 0x00000012, "RT_LINEAR_WITH_ZETA" }, | 598 | { 0x00000012, "RT_LINEAR_WITH_ZETA", NULL }, |
599 | { 0x00000015, "FP_TOO_FEW_REGS" }, | 599 | { 0x00000015, "FP_TOO_FEW_REGS", NULL }, |
600 | { 0x00000016, "ZETA_FORMAT_CSAA_MISMATCH" }, | 600 | { 0x00000016, "ZETA_FORMAT_CSAA_MISMATCH", NULL }, |
601 | { 0x00000017, "RT_LINEAR_WITH_MSAA" }, | 601 | { 0x00000017, "RT_LINEAR_WITH_MSAA", NULL }, |
602 | { 0x00000018, "FP_INTERPOLANT_START_OVER_LIMIT" }, | 602 | { 0x00000018, "FP_INTERPOLANT_START_OVER_LIMIT", NULL }, |
603 | { 0x00000019, "SEMANTIC_LAYER_OVER_LIMIT" }, | 603 | { 0x00000019, "SEMANTIC_LAYER_OVER_LIMIT", NULL }, |
604 | { 0x0000001a, "RT_INVALID_ALIGNMENT" }, | 604 | { 0x0000001a, "RT_INVALID_ALIGNMENT", NULL }, |
605 | { 0x0000001b, "SAMPLER_OVER_LIMIT" }, | 605 | { 0x0000001b, "SAMPLER_OVER_LIMIT", NULL }, |
606 | { 0x0000001c, "TEXTURE_OVER_LIMIT" }, | 606 | { 0x0000001c, "TEXTURE_OVER_LIMIT", NULL }, |
607 | { 0x0000001e, "GP_TOO_MANY_OUTPUTS" }, | 607 | { 0x0000001e, "GP_TOO_MANY_OUTPUTS", NULL }, |
608 | { 0x0000001f, "RT_BPP128_WITH_MS8" }, | 608 | { 0x0000001f, "RT_BPP128_WITH_MS8", NULL }, |
609 | { 0x00000021, "Z_OUT_OF_BOUNDS" }, | 609 | { 0x00000021, "Z_OUT_OF_BOUNDS", NULL }, |
610 | { 0x00000023, "XY_OUT_OF_BOUNDS" }, | 610 | { 0x00000023, "XY_OUT_OF_BOUNDS", NULL }, |
611 | { 0x00000027, "CP_MORE_PARAMS_THAN_SHARED" }, | 611 | { 0x00000027, "CP_MORE_PARAMS_THAN_SHARED", NULL }, |
612 | { 0x00000028, "CP_NO_REG_SPACE_STRIPED" }, | 612 | { 0x00000028, "CP_NO_REG_SPACE_STRIPED", NULL }, |
613 | { 0x00000029, "CP_NO_REG_SPACE_PACKED" }, | 613 | { 0x00000029, "CP_NO_REG_SPACE_PACKED", NULL }, |
614 | { 0x0000002a, "CP_NOT_ENOUGH_WARPS" }, | 614 | { 0x0000002a, "CP_NOT_ENOUGH_WARPS", NULL }, |
615 | { 0x0000002b, "CP_BLOCK_SIZE_MISMATCH" }, | 615 | { 0x0000002b, "CP_BLOCK_SIZE_MISMATCH", NULL }, |
616 | { 0x0000002c, "CP_NOT_ENOUGH_LOCAL_WARPS" }, | 616 | { 0x0000002c, "CP_NOT_ENOUGH_LOCAL_WARPS", NULL }, |
617 | { 0x0000002d, "CP_NOT_ENOUGH_STACK_WARPS" }, | 617 | { 0x0000002d, "CP_NOT_ENOUGH_STACK_WARPS", NULL }, |
618 | { 0x0000002e, "CP_NO_BLOCKDIM_LATCH" }, | 618 | { 0x0000002e, "CP_NO_BLOCKDIM_LATCH", NULL }, |
619 | { 0x00000031, "ENG2D_FORMAT_MISMATCH" }, | 619 | { 0x00000031, "ENG2D_FORMAT_MISMATCH", NULL }, |
620 | { 0x0000003f, "PRIMITIVE_ID_NEEDS_GP" }, | 620 | { 0x0000003f, "PRIMITIVE_ID_NEEDS_GP", NULL }, |
621 | { 0x00000044, "SEMANTIC_VIEWPORT_OVER_LIMIT" }, | 621 | { 0x00000044, "SEMANTIC_VIEWPORT_OVER_LIMIT", NULL }, |
622 | { 0x00000045, "SEMANTIC_COLOR_FRONT_OVER_LIMIT" }, | 622 | { 0x00000045, "SEMANTIC_COLOR_FRONT_OVER_LIMIT", NULL }, |
623 | { 0x00000046, "LAYER_ID_NEEDS_GP" }, | 623 | { 0x00000046, "LAYER_ID_NEEDS_GP", NULL }, |
624 | { 0x00000047, "SEMANTIC_CLIP_OVER_LIMIT" }, | 624 | { 0x00000047, "SEMANTIC_CLIP_OVER_LIMIT", NULL }, |
625 | { 0x00000048, "SEMANTIC_PTSZ_OVER_LIMIT" }, | 625 | { 0x00000048, "SEMANTIC_PTSZ_OVER_LIMIT", NULL }, |
626 | {} | 626 | {} |
627 | }; | 627 | }; |
628 | 628 | ||