drm/radeon: rename r100_cs_dump_packet to radeon_cs_dump_packet
authorIlija Hadzic <ihadzic@research.bell-labs.com>
Wed, 2 Jan 2013 23:27:45 +0000 (18:27 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 Jan 2013 21:24:44 +0000 (16:24 -0500)
This function is not limited to r100, but it can dump a
(raw) packet for any ASIC. Rename it accordingly and move
its declaration to radeon.h

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/r100_track.h
drivers/gpu/drm/radeon/r200.c
drivers/gpu/drm/radeon/r300.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_cs.c

index 7842447da4fb6e6ebc0e820a00ed87a43f7e6dfc..cf7e35903eae95c1e4390bc8a2289c1183c3a53a 100644 (file)
@@ -1219,7 +1219,7 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
        if (r) {
                DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                          idx, reg);
-               r100_cs_dump_packet(p, pkt);
+               radeon_cs_dump_packet(p, pkt);
                return r;
        }
 
@@ -1233,7 +1233,7 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
                if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) {
                        if (reg == RADEON_SRC_PITCH_OFFSET) {
                                DRM_ERROR("Cannot src blit from microtiled surface\n");
-                               r100_cs_dump_packet(p, pkt);
+                               radeon_cs_dump_packet(p, pkt);
                                return -EINVAL;
                        }
                        tile_flags |= RADEON_DST_TILE_MICRO;
@@ -1263,7 +1263,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
        if (c > 16) {
            DRM_ERROR("Only 16 vertex buffers are allowed %d\n",
                      pkt->opcode);
-           r100_cs_dump_packet(p, pkt);
+           radeon_cs_dump_packet(p, pkt);
            return -EINVAL;
        }
        track->num_arrays = c;
@@ -1272,7 +1272,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n",
                                  pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                idx_value = radeon_get_ib_value(p, idx);
@@ -1285,7 +1285,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n",
                                  pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx+2] = radeon_get_ib_value(p, idx + 2) + ((u32)reloc->lobj.gpu_offset);
@@ -1298,7 +1298,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n",
                                          pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                idx_value = radeon_get_ib_value(p, idx);
@@ -1355,20 +1355,6 @@ int r100_cs_parse_packet0(struct radeon_cs_parser *p,
        return 0;
 }
 
-void r100_cs_dump_packet(struct radeon_cs_parser *p,
-                        struct radeon_cs_packet *pkt)
-{
-       volatile uint32_t *ib;
-       unsigned i;
-       unsigned idx;
-
-       ib = p->ib.ptr;
-       idx = pkt->idx;
-       for (i = 0; i <= (pkt->count + 1); i++, idx++) {
-               DRM_INFO("ib[%d]=0x%08X\n", idx, ib[idx]);
-       }
-}
-
 /**
  * r100_cs_packet_next_vline() - parse userspace VLINE packet
  * @parser:            parser structure holding parsing context.
@@ -1492,14 +1478,14 @@ int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
        if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) {
                DRM_ERROR("No packet3 for relocation for packet at %d.\n",
                          p3reloc.idx);
-               r100_cs_dump_packet(p, &p3reloc);
+               radeon_cs_dump_packet(p, &p3reloc);
                return -EINVAL;
        }
        idx = radeon_get_ib_value(p, p3reloc.idx + 1);
        if (idx >= relocs_chunk->length_dw) {
                DRM_ERROR("Relocs at %d after relocations chunk end %d !\n",
                          idx, relocs_chunk->length_dw);
-               r100_cs_dump_packet(p, &p3reloc);
+               radeon_cs_dump_packet(p, &p3reloc);
                return -EINVAL;
        }
        /* FIXME: we assume reloc size is 4 dwords */
@@ -1584,7 +1570,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                break;
@@ -1601,7 +1587,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->zb.robj = reloc->robj;
@@ -1614,7 +1600,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->cb[0].robj = reloc->robj;
@@ -1630,7 +1616,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -1657,7 +1643,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->textures[0].cube_info[i].offset = idx_value;
@@ -1675,7 +1661,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->textures[1].cube_info[i].offset = idx_value;
@@ -1693,7 +1679,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->textures[2].cube_info[i].offset = idx_value;
@@ -1711,7 +1697,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -1782,7 +1768,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
@@ -1942,7 +1928,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
                r = r100_cs_packet_next_reloc(p, &reloc);
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx+1] = radeon_get_ib_value(p, idx+1) + ((u32)reloc->lobj.gpu_offset);
@@ -1956,7 +1942,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
                r = r100_cs_packet_next_reloc(p, &reloc);
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx] = radeon_get_ib_value(p, idx) + ((u32)reloc->lobj.gpu_offset);
index 6a603b378adbd2f3b661c1ca1a88a0ac560931f5..c81b174aaf050a3550bf4564fb07eeec365f4f7f 100644 (file)
@@ -83,8 +83,6 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)
 void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track);
 int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
                              struct radeon_cs_reloc **cs_reloc);
-void r100_cs_dump_packet(struct radeon_cs_parser *p,
-                        struct radeon_cs_packet *pkt);
 
 int r100_cs_packet_parse_vline(struct radeon_cs_parser *p);
 
index 98143a5c5b73a760c9c7f961890f5b7ea0b163ba..07ea6f4a990312a3326829dcd832cb2e55e4e26c 100644 (file)
@@ -162,7 +162,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                break;
@@ -179,7 +179,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->zb.robj = reloc->robj;
@@ -192,7 +192,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->cb[0].robj = reloc->robj;
@@ -211,7 +211,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -264,7 +264,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->textures[i].cube_info[face - 1].offset = idx_value;
@@ -282,7 +282,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
 
@@ -359,7 +359,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
index 34ca46e463477f0f7b45c35cb2c21dc52a43cd4f..47bfca14cec898ae2b9e2d6a024289ed944e4213 100644 (file)
@@ -615,7 +615,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                        idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                break;
@@ -634,7 +634,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                        idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->cb[i].robj = reloc->robj;
@@ -647,7 +647,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                        idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->zb.robj = reloc->robj;
@@ -676,7 +676,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                        idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
 
@@ -749,7 +749,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                        if (r) {
                                DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                          idx, reg);
-                               r100_cs_dump_packet(p, pkt);
+                               radeon_cs_dump_packet(p, pkt);
                                return r;
                        }
 
@@ -834,7 +834,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                        if (r) {
                                DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                          idx, reg);
-                               r100_cs_dump_packet(p, pkt);
+                               radeon_cs_dump_packet(p, pkt);
                                return r;
                        }
 
@@ -1049,7 +1049,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                        idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
@@ -1091,7 +1091,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                if (r) {
                        DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
                                  idx, reg);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                track->aa.robj = reloc->robj;
@@ -1159,7 +1159,7 @@ static int r300_packet3_check(struct radeon_cs_parser *p,
                r = r100_cs_packet_next_reloc(p, &reloc);
                if (r) {
                        DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
-                       r100_cs_dump_packet(p, pkt);
+                       radeon_cs_dump_packet(p, pkt);
                        return r;
                }
                ib[idx+1] = radeon_get_ib_value(p, idx + 1) + ((u32)reloc->lobj.gpu_offset);
index 5caeca38383d121513093d5ef684969e4d6a1f76..5f964309ba68cccb69a2a053ea0b5c70de58a062 100644 (file)
@@ -1976,6 +1976,8 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p,
                           struct radeon_cs_packet *pkt,
                           unsigned idx);
 bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p);
+void radeon_cs_dump_packet(struct radeon_cs_parser *p,
+                          struct radeon_cs_packet *pkt);
 int r600_cs_common_vline_parse(struct radeon_cs_parser *p,
                               uint32_t *vline_start_end,
                               uint32_t *vline_status);
index 56cdb44c3612dc37b08032d4c8600bb13026f13b..7f48d46a757dc825db42507956f1d8ab025e2f15 100644 (file)
@@ -716,3 +716,24 @@ bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
                return false;
        return true;
 }
+
+/**
+ * radeon_cs_dump_packet() - dump raw packet context
+ * @p:         structure holding the parser context.
+ * @pkt:       structure holding the packet.
+ *
+ * Used mostly for debugging and error reporting.
+ **/
+void radeon_cs_dump_packet(struct radeon_cs_parser *p,
+                          struct radeon_cs_packet *pkt)
+{
+       volatile uint32_t *ib;
+       unsigned i;
+       unsigned idx;
+
+       ib = p->ib.ptr;
+       idx = pkt->idx;
+       for (i = 0; i <= (pkt->count + 1); i++, idx++)
+               DRM_INFO("ib[%d]=0x%08X\n", idx, ib[idx]);
+}
+