aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlija Hadzic <ihadzic@research.bell-labs.com>2013-01-02 18:27:45 -0500
committerAlex Deucher <alexander.deucher@amd.com>2013-01-31 16:24:44 -0500
commitc3ad63afcdb931159690aa7ba2906079c3b38a13 (patch)
tree86305f43ed6c42c85e19f99c78a141c7d9e2efdb
parentd6e18a3406d401edeb96a01c7bb9d1689454c41b (diff)
drm/radeon: rename r100_cs_dump_packet to radeon_cs_dump_packet
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>
-rw-r--r--drivers/gpu/drm/radeon/r100.c52
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h2
-rw-r--r--drivers/gpu/drm/radeon/r200.c14
-rw-r--r--drivers/gpu/drm/radeon/r300.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c21
6 files changed, 58 insertions, 51 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 7842447da4fb..cf7e35903eae 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -1219,7 +1219,7 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
1219 if (r) { 1219 if (r) {
1220 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1220 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1221 idx, reg); 1221 idx, reg);
1222 r100_cs_dump_packet(p, pkt); 1222 radeon_cs_dump_packet(p, pkt);
1223 return r; 1223 return r;
1224 } 1224 }
1225 1225
@@ -1233,7 +1233,7 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
1233 if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { 1233 if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) {
1234 if (reg == RADEON_SRC_PITCH_OFFSET) { 1234 if (reg == RADEON_SRC_PITCH_OFFSET) {
1235 DRM_ERROR("Cannot src blit from microtiled surface\n"); 1235 DRM_ERROR("Cannot src blit from microtiled surface\n");
1236 r100_cs_dump_packet(p, pkt); 1236 radeon_cs_dump_packet(p, pkt);
1237 return -EINVAL; 1237 return -EINVAL;
1238 } 1238 }
1239 tile_flags |= RADEON_DST_TILE_MICRO; 1239 tile_flags |= RADEON_DST_TILE_MICRO;
@@ -1263,7 +1263,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
1263 if (c > 16) { 1263 if (c > 16) {
1264 DRM_ERROR("Only 16 vertex buffers are allowed %d\n", 1264 DRM_ERROR("Only 16 vertex buffers are allowed %d\n",
1265 pkt->opcode); 1265 pkt->opcode);
1266 r100_cs_dump_packet(p, pkt); 1266 radeon_cs_dump_packet(p, pkt);
1267 return -EINVAL; 1267 return -EINVAL;
1268 } 1268 }
1269 track->num_arrays = c; 1269 track->num_arrays = c;
@@ -1272,7 +1272,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
1272 if (r) { 1272 if (r) {
1273 DRM_ERROR("No reloc for packet3 %d\n", 1273 DRM_ERROR("No reloc for packet3 %d\n",
1274 pkt->opcode); 1274 pkt->opcode);
1275 r100_cs_dump_packet(p, pkt); 1275 radeon_cs_dump_packet(p, pkt);
1276 return r; 1276 return r;
1277 } 1277 }
1278 idx_value = radeon_get_ib_value(p, idx); 1278 idx_value = radeon_get_ib_value(p, idx);
@@ -1285,7 +1285,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
1285 if (r) { 1285 if (r) {
1286 DRM_ERROR("No reloc for packet3 %d\n", 1286 DRM_ERROR("No reloc for packet3 %d\n",
1287 pkt->opcode); 1287 pkt->opcode);
1288 r100_cs_dump_packet(p, pkt); 1288 radeon_cs_dump_packet(p, pkt);
1289 return r; 1289 return r;
1290 } 1290 }
1291 ib[idx+2] = radeon_get_ib_value(p, idx + 2) + ((u32)reloc->lobj.gpu_offset); 1291 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,
1298 if (r) { 1298 if (r) {
1299 DRM_ERROR("No reloc for packet3 %d\n", 1299 DRM_ERROR("No reloc for packet3 %d\n",
1300 pkt->opcode); 1300 pkt->opcode);
1301 r100_cs_dump_packet(p, pkt); 1301 radeon_cs_dump_packet(p, pkt);
1302 return r; 1302 return r;
1303 } 1303 }
1304 idx_value = radeon_get_ib_value(p, idx); 1304 idx_value = radeon_get_ib_value(p, idx);
@@ -1355,20 +1355,6 @@ int r100_cs_parse_packet0(struct radeon_cs_parser *p,
1355 return 0; 1355 return 0;
1356} 1356}
1357 1357
1358void r100_cs_dump_packet(struct radeon_cs_parser *p,
1359 struct radeon_cs_packet *pkt)
1360{
1361 volatile uint32_t *ib;
1362 unsigned i;
1363 unsigned idx;
1364
1365 ib = p->ib.ptr;
1366 idx = pkt->idx;
1367 for (i = 0; i <= (pkt->count + 1); i++, idx++) {
1368 DRM_INFO("ib[%d]=0x%08X\n", idx, ib[idx]);
1369 }
1370}
1371
1372/** 1358/**
1373 * r100_cs_packet_next_vline() - parse userspace VLINE packet 1359 * r100_cs_packet_next_vline() - parse userspace VLINE packet
1374 * @parser: parser structure holding parsing context. 1360 * @parser: parser structure holding parsing context.
@@ -1492,14 +1478,14 @@ int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
1492 if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) { 1478 if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) {
1493 DRM_ERROR("No packet3 for relocation for packet at %d.\n", 1479 DRM_ERROR("No packet3 for relocation for packet at %d.\n",
1494 p3reloc.idx); 1480 p3reloc.idx);
1495 r100_cs_dump_packet(p, &p3reloc); 1481 radeon_cs_dump_packet(p, &p3reloc);
1496 return -EINVAL; 1482 return -EINVAL;
1497 } 1483 }
1498 idx = radeon_get_ib_value(p, p3reloc.idx + 1); 1484 idx = radeon_get_ib_value(p, p3reloc.idx + 1);
1499 if (idx >= relocs_chunk->length_dw) { 1485 if (idx >= relocs_chunk->length_dw) {
1500 DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", 1486 DRM_ERROR("Relocs at %d after relocations chunk end %d !\n",
1501 idx, relocs_chunk->length_dw); 1487 idx, relocs_chunk->length_dw);
1502 r100_cs_dump_packet(p, &p3reloc); 1488 radeon_cs_dump_packet(p, &p3reloc);
1503 return -EINVAL; 1489 return -EINVAL;
1504 } 1490 }
1505 /* FIXME: we assume reloc size is 4 dwords */ 1491 /* FIXME: we assume reloc size is 4 dwords */
@@ -1584,7 +1570,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1584 if (r) { 1570 if (r) {
1585 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1571 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1586 idx, reg); 1572 idx, reg);
1587 r100_cs_dump_packet(p, pkt); 1573 radeon_cs_dump_packet(p, pkt);
1588 return r; 1574 return r;
1589 } 1575 }
1590 break; 1576 break;
@@ -1601,7 +1587,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1601 if (r) { 1587 if (r) {
1602 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1588 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1603 idx, reg); 1589 idx, reg);
1604 r100_cs_dump_packet(p, pkt); 1590 radeon_cs_dump_packet(p, pkt);
1605 return r; 1591 return r;
1606 } 1592 }
1607 track->zb.robj = reloc->robj; 1593 track->zb.robj = reloc->robj;
@@ -1614,7 +1600,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1614 if (r) { 1600 if (r) {
1615 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1601 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1616 idx, reg); 1602 idx, reg);
1617 r100_cs_dump_packet(p, pkt); 1603 radeon_cs_dump_packet(p, pkt);
1618 return r; 1604 return r;
1619 } 1605 }
1620 track->cb[0].robj = reloc->robj; 1606 track->cb[0].robj = reloc->robj;
@@ -1630,7 +1616,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1630 if (r) { 1616 if (r) {
1631 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1617 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1632 idx, reg); 1618 idx, reg);
1633 r100_cs_dump_packet(p, pkt); 1619 radeon_cs_dump_packet(p, pkt);
1634 return r; 1620 return r;
1635 } 1621 }
1636 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) { 1622 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -1657,7 +1643,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1657 if (r) { 1643 if (r) {
1658 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1644 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1659 idx, reg); 1645 idx, reg);
1660 r100_cs_dump_packet(p, pkt); 1646 radeon_cs_dump_packet(p, pkt);
1661 return r; 1647 return r;
1662 } 1648 }
1663 track->textures[0].cube_info[i].offset = idx_value; 1649 track->textures[0].cube_info[i].offset = idx_value;
@@ -1675,7 +1661,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1675 if (r) { 1661 if (r) {
1676 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1662 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1677 idx, reg); 1663 idx, reg);
1678 r100_cs_dump_packet(p, pkt); 1664 radeon_cs_dump_packet(p, pkt);
1679 return r; 1665 return r;
1680 } 1666 }
1681 track->textures[1].cube_info[i].offset = idx_value; 1667 track->textures[1].cube_info[i].offset = idx_value;
@@ -1693,7 +1679,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1693 if (r) { 1679 if (r) {
1694 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1680 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1695 idx, reg); 1681 idx, reg);
1696 r100_cs_dump_packet(p, pkt); 1682 radeon_cs_dump_packet(p, pkt);
1697 return r; 1683 return r;
1698 } 1684 }
1699 track->textures[2].cube_info[i].offset = idx_value; 1685 track->textures[2].cube_info[i].offset = idx_value;
@@ -1711,7 +1697,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1711 if (r) { 1697 if (r) {
1712 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1698 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1713 idx, reg); 1699 idx, reg);
1714 r100_cs_dump_packet(p, pkt); 1700 radeon_cs_dump_packet(p, pkt);
1715 return r; 1701 return r;
1716 } 1702 }
1717 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) { 1703 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -1782,7 +1768,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1782 if (r) { 1768 if (r) {
1783 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1769 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1784 idx, reg); 1770 idx, reg);
1785 r100_cs_dump_packet(p, pkt); 1771 radeon_cs_dump_packet(p, pkt);
1786 return r; 1772 return r;
1787 } 1773 }
1788 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); 1774 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
@@ -1942,7 +1928,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
1942 r = r100_cs_packet_next_reloc(p, &reloc); 1928 r = r100_cs_packet_next_reloc(p, &reloc);
1943 if (r) { 1929 if (r) {
1944 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode); 1930 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
1945 r100_cs_dump_packet(p, pkt); 1931 radeon_cs_dump_packet(p, pkt);
1946 return r; 1932 return r;
1947 } 1933 }
1948 ib[idx+1] = radeon_get_ib_value(p, idx+1) + ((u32)reloc->lobj.gpu_offset); 1934 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,
1956 r = r100_cs_packet_next_reloc(p, &reloc); 1942 r = r100_cs_packet_next_reloc(p, &reloc);
1957 if (r) { 1943 if (r) {
1958 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode); 1944 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
1959 r100_cs_dump_packet(p, pkt); 1945 radeon_cs_dump_packet(p, pkt);
1960 return r; 1946 return r;
1961 } 1947 }
1962 ib[idx] = radeon_get_ib_value(p, idx) + ((u32)reloc->lobj.gpu_offset); 1948 ib[idx] = radeon_get_ib_value(p, idx) + ((u32)reloc->lobj.gpu_offset);
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index 6a603b378adb..c81b174aaf05 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -83,8 +83,6 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)
83void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track); 83void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track);
84int r100_cs_packet_next_reloc(struct radeon_cs_parser *p, 84int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
85 struct radeon_cs_reloc **cs_reloc); 85 struct radeon_cs_reloc **cs_reloc);
86void r100_cs_dump_packet(struct radeon_cs_parser *p,
87 struct radeon_cs_packet *pkt);
88 86
89int r100_cs_packet_parse_vline(struct radeon_cs_parser *p); 87int r100_cs_packet_parse_vline(struct radeon_cs_parser *p);
90 88
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 98143a5c5b73..07ea6f4a9903 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -162,7 +162,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
162 if (r) { 162 if (r) {
163 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 163 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
164 idx, reg); 164 idx, reg);
165 r100_cs_dump_packet(p, pkt); 165 radeon_cs_dump_packet(p, pkt);
166 return r; 166 return r;
167 } 167 }
168 break; 168 break;
@@ -179,7 +179,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
179 if (r) { 179 if (r) {
180 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 180 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
181 idx, reg); 181 idx, reg);
182 r100_cs_dump_packet(p, pkt); 182 radeon_cs_dump_packet(p, pkt);
183 return r; 183 return r;
184 } 184 }
185 track->zb.robj = reloc->robj; 185 track->zb.robj = reloc->robj;
@@ -192,7 +192,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
192 if (r) { 192 if (r) {
193 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 193 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
194 idx, reg); 194 idx, reg);
195 r100_cs_dump_packet(p, pkt); 195 radeon_cs_dump_packet(p, pkt);
196 return r; 196 return r;
197 } 197 }
198 track->cb[0].robj = reloc->robj; 198 track->cb[0].robj = reloc->robj;
@@ -211,7 +211,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
211 if (r) { 211 if (r) {
212 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 212 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
213 idx, reg); 213 idx, reg);
214 r100_cs_dump_packet(p, pkt); 214 radeon_cs_dump_packet(p, pkt);
215 return r; 215 return r;
216 } 216 }
217 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) { 217 if (!(p->cs_flags & RADEON_CS_KEEP_TILING_FLAGS)) {
@@ -264,7 +264,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
264 if (r) { 264 if (r) {
265 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 265 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
266 idx, reg); 266 idx, reg);
267 r100_cs_dump_packet(p, pkt); 267 radeon_cs_dump_packet(p, pkt);
268 return r; 268 return r;
269 } 269 }
270 track->textures[i].cube_info[face - 1].offset = idx_value; 270 track->textures[i].cube_info[face - 1].offset = idx_value;
@@ -282,7 +282,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
282 if (r) { 282 if (r) {
283 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 283 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
284 idx, reg); 284 idx, reg);
285 r100_cs_dump_packet(p, pkt); 285 radeon_cs_dump_packet(p, pkt);
286 return r; 286 return r;
287 } 287 }
288 288
@@ -359,7 +359,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
359 if (r) { 359 if (r) {
360 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 360 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
361 idx, reg); 361 idx, reg);
362 r100_cs_dump_packet(p, pkt); 362 radeon_cs_dump_packet(p, pkt);
363 return r; 363 return r;
364 } 364 }
365 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); 365 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 34ca46e46347..47bfca14cec8 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -615,7 +615,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
615 if (r) { 615 if (r) {
616 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 616 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
617 idx, reg); 617 idx, reg);
618 r100_cs_dump_packet(p, pkt); 618 radeon_cs_dump_packet(p, pkt);
619 return r; 619 return r;
620 } 620 }
621 break; 621 break;
@@ -634,7 +634,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
634 if (r) { 634 if (r) {
635 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 635 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
636 idx, reg); 636 idx, reg);
637 r100_cs_dump_packet(p, pkt); 637 radeon_cs_dump_packet(p, pkt);
638 return r; 638 return r;
639 } 639 }
640 track->cb[i].robj = reloc->robj; 640 track->cb[i].robj = reloc->robj;
@@ -647,7 +647,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
647 if (r) { 647 if (r) {
648 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 648 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
649 idx, reg); 649 idx, reg);
650 r100_cs_dump_packet(p, pkt); 650 radeon_cs_dump_packet(p, pkt);
651 return r; 651 return r;
652 } 652 }
653 track->zb.robj = reloc->robj; 653 track->zb.robj = reloc->robj;
@@ -676,7 +676,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
676 if (r) { 676 if (r) {
677 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 677 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
678 idx, reg); 678 idx, reg);
679 r100_cs_dump_packet(p, pkt); 679 radeon_cs_dump_packet(p, pkt);
680 return r; 680 return r;
681 } 681 }
682 682
@@ -749,7 +749,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
749 if (r) { 749 if (r) {
750 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 750 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
751 idx, reg); 751 idx, reg);
752 r100_cs_dump_packet(p, pkt); 752 radeon_cs_dump_packet(p, pkt);
753 return r; 753 return r;
754 } 754 }
755 755
@@ -834,7 +834,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
834 if (r) { 834 if (r) {
835 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 835 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
836 idx, reg); 836 idx, reg);
837 r100_cs_dump_packet(p, pkt); 837 radeon_cs_dump_packet(p, pkt);
838 return r; 838 return r;
839 } 839 }
840 840
@@ -1049,7 +1049,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
1049 if (r) { 1049 if (r) {
1050 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1050 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1051 idx, reg); 1051 idx, reg);
1052 r100_cs_dump_packet(p, pkt); 1052 radeon_cs_dump_packet(p, pkt);
1053 return r; 1053 return r;
1054 } 1054 }
1055 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); 1055 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
@@ -1091,7 +1091,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
1091 if (r) { 1091 if (r) {
1092 DRM_ERROR("No reloc for ib[%d]=0x%04X\n", 1092 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1093 idx, reg); 1093 idx, reg);
1094 r100_cs_dump_packet(p, pkt); 1094 radeon_cs_dump_packet(p, pkt);
1095 return r; 1095 return r;
1096 } 1096 }
1097 track->aa.robj = reloc->robj; 1097 track->aa.robj = reloc->robj;
@@ -1159,7 +1159,7 @@ static int r300_packet3_check(struct radeon_cs_parser *p,
1159 r = r100_cs_packet_next_reloc(p, &reloc); 1159 r = r100_cs_packet_next_reloc(p, &reloc);
1160 if (r) { 1160 if (r) {
1161 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode); 1161 DRM_ERROR("No reloc for packet3 %d\n", pkt->opcode);
1162 r100_cs_dump_packet(p, pkt); 1162 radeon_cs_dump_packet(p, pkt);
1163 return r; 1163 return r;
1164 } 1164 }
1165 ib[idx+1] = radeon_get_ib_value(p, idx + 1) + ((u32)reloc->lobj.gpu_offset); 1165 ib[idx+1] = radeon_get_ib_value(p, idx + 1) + ((u32)reloc->lobj.gpu_offset);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5caeca38383d..5f964309ba68 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1976,6 +1976,8 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p,
1976 struct radeon_cs_packet *pkt, 1976 struct radeon_cs_packet *pkt,
1977 unsigned idx); 1977 unsigned idx);
1978bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p); 1978bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p);
1979void radeon_cs_dump_packet(struct radeon_cs_parser *p,
1980 struct radeon_cs_packet *pkt);
1979int r600_cs_common_vline_parse(struct radeon_cs_parser *p, 1981int r600_cs_common_vline_parse(struct radeon_cs_parser *p,
1980 uint32_t *vline_start_end, 1982 uint32_t *vline_start_end,
1981 uint32_t *vline_status); 1983 uint32_t *vline_status);
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 56cdb44c3612..7f48d46a757d 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -716,3 +716,24 @@ bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
716 return false; 716 return false;
717 return true; 717 return true;
718} 718}
719
720/**
721 * radeon_cs_dump_packet() - dump raw packet context
722 * @p: structure holding the parser context.
723 * @pkt: structure holding the packet.
724 *
725 * Used mostly for debugging and error reporting.
726 **/
727void radeon_cs_dump_packet(struct radeon_cs_parser *p,
728 struct radeon_cs_packet *pkt)
729{
730 volatile uint32_t *ib;
731 unsigned i;
732 unsigned idx;
733
734 ib = p->ib.ptr;
735 idx = pkt->idx;
736 for (i = 0; i <= (pkt->count + 1); i++, idx++)
737 DRM_INFO("ib[%d]=0x%08X\n", idx, ib[idx]);
738}
739