28 #include <linux/kernel.h>
32 #include "r600_reg_safe.h"
39 static next_reloc_t r600_cs_packet_next_reloc = &r600_cs_packet_next_reloc_mm;
91 #define FMT_8_BIT(fmt, vc) [fmt] = { 1, 1, 1, vc, CHIP_R600 }
92 #define FMT_16_BIT(fmt, vc) [fmt] = { 1, 1, 2, vc, CHIP_R600 }
93 #define FMT_24_BIT(fmt) [fmt] = { 1, 1, 4, 0, CHIP_R600 }
94 #define FMT_32_BIT(fmt, vc) [fmt] = { 1, 1, 4, vc, CHIP_R600 }
95 #define FMT_48_BIT(fmt) [fmt] = { 1, 1, 8, 0, CHIP_R600 }
96 #define FMT_64_BIT(fmt, vc) [fmt] = { 1, 1, 8, vc, CHIP_R600 }
97 #define FMT_96_BIT(fmt) [fmt] = { 1, 1, 12, 0, CHIP_R600 }
98 #define FMT_128_BIT(fmt, vc) [fmt] = { 1, 1, 16,vc, CHIP_R600 }
108 static const struct gpu_formats color_formats_table[] = {
184 if (format >=
ARRAY_SIZE(color_formats_table))
195 if (format >=
ARRAY_SIZE(color_formats_table))
198 if (family < color_formats_table[format].
min_family)
201 if (color_formats_table[format].
blockwidth > 0)
209 if (format >=
ARRAY_SIZE(color_formats_table))
219 if (format >=
ARRAY_SIZE(color_formats_table))
226 return (w + bw - 1) / bw;
233 if (format >=
ARRAY_SIZE(color_formats_table))
240 return (h + bh - 1) / bh;
264 u32 macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes;
281 *pitch_align =
max((
u32)tile_width,
284 *height_align = tile_height;
289 *pitch_align =
max((
u32)macro_tile_width * tile_width,
292 *height_align = macro_tile_height * tile_height;
294 *base_align =
max(macro_tile_bytes,
310 for (i = 0; i < 8; i++) {
344 for (i = 0; i < 4; i++) {
358 u32 height, height_align, pitch, pitch_align, depth_align;
361 volatile u32 *ib = p->
ib.ptr;
370 dev_warn(p->
dev,
"%s:%d cb invalid format %d for %d (0x%08X)\n",
371 __func__, __LINE__, format,
378 slice_tile_max *= 64;
379 height = slice_tile_max / pitch;
387 array_check.nbanks = track->
nbanks;
388 array_check.npipes = track->
npipes;
391 if (r600_get_array_mode_alignment(&array_check,
392 &pitch_align, &height_align, &depth_align, &base_align)) {
393 dev_warn(p->
dev,
"%s invalid tiling %d for %d (0x%08X)\n", __func__,
398 switch (array_mode) {
411 dev_warn(p->
dev,
"%s invalid tiling %d for %d (0x%08X)\n", __func__,
418 dev_warn(p->
dev,
"%s:%d cb pitch (%d, 0x%x, %d) invalid\n",
419 __func__, __LINE__, pitch, pitch_align, array_mode);
423 dev_warn(p->
dev,
"%s:%d cb height (%d, 0x%x, %d) invalid\n",
424 __func__, __LINE__, height, height_align, array_mode);
428 dev_warn(p->
dev,
"%s offset[%d] 0x%llx 0x%llx, %d not aligned\n", __func__, i,
429 base_offset, base_align, array_mode);
436 switch (array_mode) {
456 dev_warn(p->
dev,
"%s offset[%d] %d %llu %d %lu too big (%d %d) (%d %d %d)\n",
457 __func__, i, array_mode,
467 tmp = (height * pitch) >> 6;
468 if (tmp < slice_tile_max)
469 slice_tile_max =
tmp;
488 "(tile_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n",
489 __func__, tile_max, bytes,
501 uint32_t bytes = (block_max + 1) * 128;
506 "(block_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n",
507 __func__, block_max, bytes,
515 dev_warn(p->
dev,
"%s invalid tile mode\n", __func__);
524 u32 nviews, bpe, ntiles,
size, slice_tile_max,
tmp;
525 u32 height_align, pitch_align, depth_align;
531 volatile u32 *ib = p->
ib.ptr;
535 dev_warn(p->
dev,
"z/stencil with no depth buffer\n");
558 dev_warn(p->
dev,
"z/stencil buffer size not set\n");
562 tmp = (tmp / bpe) >> 6;
564 dev_warn(p->
dev,
"z/stencil buffer too small (0x%08X %d %d %ld)\n",
566 radeon_bo_size(track->
db_bo));
571 size = radeon_bo_size(track->
db_bo);
575 slice_tile_max *= 64;
576 height = slice_tile_max / pitch;
583 array_check.nbanks = track->
nbanks;
584 array_check.npipes = track->
npipes;
585 array_check.nsamples = track->
nsamples;
586 array_check.blocksize = bpe;
587 if (r600_get_array_mode_alignment(&array_check,
588 &pitch_align, &height_align, &depth_align, &base_align)) {
589 dev_warn(p->
dev,
"%s invalid tiling %d (0x%08X)\n", __func__,
594 switch (array_mode) {
602 dev_warn(p->
dev,
"%s invalid tiling %d (0x%08X)\n", __func__,
609 dev_warn(p->
dev,
"%s:%d db pitch (%d, 0x%x, %d) invalid\n",
610 __func__, __LINE__, pitch, pitch_align, array_mode);
614 dev_warn(p->
dev,
"%s:%d db height (%d, 0x%x, %d) invalid\n",
615 __func__, __LINE__, height, height_align, array_mode);
619 dev_warn(p->
dev,
"%s offset 0x%llx, 0x%llx, %d not aligned\n", __func__,
620 base_offset, base_align, array_mode);
626 tmp = ntiles * bpe * 64 * nviews * track->
nsamples;
628 dev_warn(p->
dev,
"z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n",
631 radeon_bo_size(track->
db_bo));
642 dev_warn(p->
dev,
"%s:%d htile enabled without htile surface 0x%08x\n",
647 dev_warn(p->
dev,
"%s:%d htile can't be enabled with bogus db_depth_size 0x%08x\n",
744 __func__, __LINE__, track->
npipes);
751 size = nbx * nby * 4;
754 if (size > radeon_bo_size(track->
htile_bo)) {
755 dev_warn(p->
dev,
"%s:%d htile surface too small %ld for %ld (%d %d)\n",
756 __func__, __LINE__, radeon_bo_size(track->
htile_bo),
778 for (i = 0; i < 4; i++) {
784 DRM_ERROR(
"streamout %d bo too small: 0x%llx, 0x%lx\n",
790 dev_warn(p->
dev,
"No buffer for streamout %d\n", i);
812 for (i = 0; i < 8; i++) {
813 if ((tmp >> (i * 4)) & 0xF) {
816 dev_warn(p->
dev,
"%s:%d mask 0x%08X | 0x%08X no cb for %d\n",
821 r = r600_cs_track_validate_cb(p, i);
834 r = r600_cs_track_validate_db(p);
858 DRM_ERROR(
"Can not parse packet at %d after CS end %d !\n",
878 DRM_ERROR(
"Unknown packet type %d at %d !\n", pkt->
type, idx);
882 DRM_ERROR(
"Packet (%d:%d:%d) end after CS buffer (%d) !\n",
909 DRM_ERROR(
"No relocation chunk !\n");
914 r = r600_cs_packet_parse(p, &p3reloc, p->
idx);
918 p->
idx += p3reloc.count + 2;
920 DRM_ERROR(
"No packet3 for relocation for packet at %d.\n",
926 DRM_ERROR(
"Relocs at %d after relocations chunk end %d !\n",
955 DRM_ERROR(
"No relocation chunk !\n");
960 r = r600_cs_packet_parse(p, &p3reloc, p->
idx);
964 p->
idx += p3reloc.count + 2;
966 DRM_ERROR(
"No packet3 for relocation for packet at %d.\n",
972 DRM_ERROR(
"Relocs at %d after relocations chunk end %d !\n",
977 (*cs_reloc)->lobj.gpu_offset = (
u64)relocs_chunk->
kdata[idx + 3] << 32;
978 (*cs_reloc)->lobj.gpu_offset |= relocs_chunk->
kdata[idx + 0];
994 r = r600_cs_packet_parse(p, &p3reloc, p->
idx);
1032 r = r600_cs_packet_parse(p, &wait_reg_mem, p->
idx);
1039 DRM_ERROR(
"vline wait missing WAIT_REG_MEM segment\n");
1045 if (wait_reg_mem_info & 0x10) {
1046 DRM_ERROR(
"vline WAIT_REG_MEM waiting on MEM rather than REG\n");
1050 if ((wait_reg_mem_info & 0x7) != 0x3) {
1051 DRM_ERROR(
"vline WAIT_REG_MEM function not equal\n");
1055 DRM_ERROR(
"vline WAIT_REG_MEM bad reg\n");
1060 DRM_ERROR(
"vline WAIT_REG_MEM bad bit mask\n");
1065 r = r600_cs_packet_parse(p, &p3reloc, p->
idx + wait_reg_mem.count + 2);
1070 p->
idx += wait_reg_mem.count + 2;
1071 p->
idx += p3reloc.count + 2;
1079 DRM_ERROR(
"cannot find crtc %d\n", crtc_id);
1084 crtc_id = radeon_crtc->
crtc_id;
1095 }
else if (crtc_id == 1) {
1102 DRM_ERROR(
"unknown crtc reloc\n");
1114 unsigned idx,
unsigned reg)
1120 r = r600_cs_packet_parse_vline(p);
1122 DRM_ERROR(
"No reloc for ib[%d]=0x%04X\n",
1144 for (i = 0; i <= pkt->
count; i++, idx++, reg += 4) {
1145 r = r600_packet0_check(p, pkt, idx, reg);
1172 dev_warn(p->
dev,
"forbidden register 0x%08x at %d\n", reg, idx);
1175 m = 1 << ((reg >> 2) & 31);
1176 if (!(r600_reg_safe_bm[i] & m))
1214 r600_cs_packet_next_is_pkt3_nop(p)) {
1215 r = r600_cs_packet_next_reloc(p, &reloc);
1257 r = r600_cs_packet_next_reloc(p, &reloc);
1265 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1280 r = r600_cs_packet_next_reloc(p, &reloc);
1282 dev_warn(p->
dev,
"missing reloc for CP_COHER_BASE "
1286 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1315 r600_cs_packet_next_is_pkt3_nop(p)) {
1316 r = r600_cs_packet_next_reloc(p, &reloc);
1318 dev_err(p->
dev,
"bad SET_CONTEXT_REG 0x%04X\n", reg);
1379 if (!r600_cs_packet_next_is_pkt3_nop(p)) {
1381 dev_err(p->
dev,
"Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg);
1388 r = r600_cs_packet_next_reloc(p, &reloc);
1390 dev_err(p->
dev,
"bad SET_CONTEXT_REG 0x%04X\n", reg);
1395 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1410 if (!r600_cs_packet_next_is_pkt3_nop(p)) {
1412 dev_err(p->
dev,
"Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg);
1419 r = r600_cs_packet_next_reloc(p, &reloc);
1421 dev_err(p->
dev,
"bad SET_CONTEXT_REG 0x%04X\n", reg);
1426 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1454 r = r600_cs_packet_next_reloc(p, &reloc);
1462 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1469 r = r600_cs_packet_next_reloc(p, &reloc);
1476 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1477 track->
db_bo = reloc->robj;
1478 track->
db_bo_mc = reloc->lobj.gpu_offset;
1482 r = r600_cs_packet_next_reloc(p, &reloc);
1489 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1550 r = r600_cs_packet_next_reloc(p, &reloc);
1556 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1559 r = r600_cs_packet_next_reloc(p, &reloc);
1565 ib[
idx] += (
u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1571 dev_warn(p->
dev,
"forbidden register 0x%08x at %d\n", reg, idx);
1581 val =
max(1
U, size >> level);
1587 static void r600_texture_size(
unsigned nfaces,
unsigned blevel,
unsigned llevel,
1588 unsigned w0,
unsigned h0,
unsigned d0,
unsigned nsamples,
unsigned format,
1589 unsigned block_align,
unsigned height_align,
unsigned base_align,
1590 unsigned *l0_size,
unsigned *mipmap_size)
1596 unsigned nlevels = llevel - blevel + 1;
1604 for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
1616 size = nbx * nby * blocksize *
nsamples;
1625 if (i == 0 || i == 1)
1626 offset =
round_up(offset, base_align);
1632 *mipmap_size = *l0_size;
1634 *mipmap_size -= *l0_size;
1655 u32 dim, nfaces, llevel, blevel,
w0, h0,
d0;
1656 u32 word0, word1, l0_size, mipmap_size, word2, word3, word4, word5;
1657 u32 height_align, pitch, pitch_align, depth_align;
1695 array_check.nbanks = track->
nbanks;
1696 array_check.npipes = track->
npipes;
1697 array_check.nsamples = 1;
1720 array_check.nsamples = 1 << llevel;
1728 dev_warn(p->
dev,
"%s:%d texture invalid format %d\n",
1729 __func__, __LINE__, format);
1733 if (r600_get_array_mode_alignment(&array_check,
1734 &pitch_align, &height_align, &depth_align, &base_align)) {
1735 dev_warn(p->
dev,
"%s:%d tex array mode (%d) invalid\n",
1743 dev_warn(p->
dev,
"%s:%d tex pitch (%d, 0x%x, %d) invalid\n",
1748 dev_warn(p->
dev,
"%s:%d tex base offset (0x%llx, 0x%llx, %d) invalid\n",
1753 dev_warn(p->
dev,
"%s:%d tex mip offset (0x%llx, 0x%llx, %d) invalid\n",
1758 if (blevel > llevel) {
1759 dev_warn(p->
dev,
"texture blevel %d > llevel %d\n",
1766 nfaces = larray - barray + 1;
1768 r600_texture_size(nfaces, blevel, llevel, w0, h0, d0, array_check.nsamples, format,
1769 pitch_align, height_align, base_align,
1770 &l0_size, &mipmap_size);
1772 if ((l0_size + word2) > radeon_bo_size(texture)) {
1773 dev_warn(p->
dev,
"texture bo too small ((%d %d) (%d %d) %d %d %d -> %d have %ld)\n",
1774 w0, h0, pitch_align, height_align,
1775 array_check.array_mode, format, word2,
1776 l0_size, radeon_bo_size(texture));
1777 dev_warn(p->
dev,
"alignments %d %d %d %lld\n", pitch, pitch_align, height_align, base_align);
1781 if ((mipmap_size + word3) > radeon_bo_size(mipmap)) {
1794 dev_warn(p->
dev,
"forbidden register 0x%08x at %d\n", reg, idx);
1797 m = 1 << ((reg >> 2) & 31);
1798 if (!(r600_reg_safe_bm[i] & m))
1800 dev_warn(p->
dev,
"forbidden register 0x%08x at %d\n", reg, idx);
1812 unsigned start_reg, end_reg,
reg;
1828 if (pkt->
count != 1) {
1829 DRM_ERROR(
"bad SET PREDICATION\n");
1834 pred_op = (tmp >> 16) & 0x7;
1841 DRM_ERROR(
"bad SET PREDICATION operation %d\n", pred_op);
1845 r = r600_cs_packet_next_reloc(p, &reloc);
1847 DRM_ERROR(
"bad SET PREDICATION\n");
1851 offset = reloc->
lobj.gpu_offset +
1852 (idx_value & 0xfffffff0) +
1853 ((
u64)(tmp & 0xff) << 32);
1856 ib[idx + 1] = (tmp & 0xffffff00) | (
upper_32_bits(offset) & 0xff);
1862 DRM_ERROR(
"bad START_3D\n");
1867 if (pkt->
count != 1) {
1868 DRM_ERROR(
"bad CONTEXT_CONTROL\n");
1875 DRM_ERROR(
"bad INDEX_TYPE/NUM_INSTANCES\n");
1882 if (pkt->
count != 3) {
1883 DRM_ERROR(
"bad DRAW_INDEX\n");
1886 r = r600_cs_packet_next_reloc(p, &reloc);
1888 DRM_ERROR(
"bad DRAW_INDEX\n");
1892 offset = reloc->
lobj.gpu_offset +
1899 r = r600_cs_track_check(p);
1901 dev_warn(p->
dev,
"%s:%d invalid cmd stream\n", __func__, __LINE__);
1907 if (pkt->
count != 1) {
1908 DRM_ERROR(
"bad DRAW_INDEX_AUTO\n");
1911 r = r600_cs_track_check(p);
1913 dev_warn(p->
dev,
"%s:%d invalid cmd stream %d\n", __func__, __LINE__, idx);
1919 if (pkt->
count < 2) {
1920 DRM_ERROR(
"bad DRAW_INDEX_IMMD\n");
1923 r = r600_cs_track_check(p);
1925 dev_warn(p->
dev,
"%s:%d invalid cmd stream\n", __func__, __LINE__);
1930 if (pkt->
count != 5) {
1931 DRM_ERROR(
"bad WAIT_REG_MEM\n");
1935 if (idx_value & 0x10) {
1938 r = r600_cs_packet_next_reloc(p, &reloc);
1940 DRM_ERROR(
"bad WAIT_REG_MEM\n");
1944 offset = reloc->
lobj.gpu_offset +
1948 ib[idx+1] = (ib[idx+1] & 0x3) | (offset & 0xfffffff0);
1953 if (pkt->
count != 3) {
1954 DRM_ERROR(
"bad SURFACE_SYNC\n");
1960 r = r600_cs_packet_next_reloc(p, &reloc);
1962 DRM_ERROR(
"bad SURFACE_SYNC\n");
1965 ib[idx+2] += (
u32)((reloc->
lobj.gpu_offset >> 8) & 0xffffffff);
1970 DRM_ERROR(
"bad EVENT_WRITE\n");
1976 r = r600_cs_packet_next_reloc(p, &reloc);
1978 DRM_ERROR(
"bad EVENT_WRITE\n");
1981 offset = reloc->
lobj.gpu_offset +
1985 ib[idx+1] = offset & 0xfffffff8;
1993 if (pkt->
count != 4) {
1994 DRM_ERROR(
"bad EVENT_WRITE_EOP\n");
1997 r = r600_cs_packet_next_reloc(p, &reloc);
1999 DRM_ERROR(
"bad EVENT_WRITE\n");
2003 offset = reloc->
lobj.gpu_offset +
2007 ib[idx+1] = offset & 0xfffffffc;
2008 ib[idx+2] = (ib[idx+2] & 0xffffff00) | (
upper_32_bits(offset) & 0xff);
2013 end_reg = 4 * pkt->
count + start_reg - 4;
2017 DRM_ERROR(
"bad PACKET3_SET_CONFIG_REG\n");
2020 for (i = 0; i < pkt->
count; i++) {
2021 reg = start_reg + (4 *
i);
2022 r = r600_cs_check_reg(p, reg, idx+1+i);
2029 end_reg = 4 * pkt->
count + start_reg - 4;
2033 DRM_ERROR(
"bad PACKET3_SET_CONTEXT_REG\n");
2036 for (i = 0; i < pkt->
count; i++) {
2037 reg = start_reg + (4 *
i);
2038 r = r600_cs_check_reg(p, reg, idx+1+i);
2044 if (pkt->
count % 7) {
2045 DRM_ERROR(
"bad SET_RESOURCE\n");
2049 end_reg = 4 * pkt->
count + start_reg - 4;
2053 DRM_ERROR(
"bad SET_RESOURCE\n");
2056 for (i = 0; i < (pkt->
count / 7); i++) {
2063 r = r600_cs_packet_next_reloc(p, &reloc);
2065 DRM_ERROR(
"bad SET_RESOURCE\n");
2068 base_offset = (
u32)((reloc->
lobj.gpu_offset >> 8) & 0xffffffff);
2070 if (reloc->
lobj.tiling_flags & RADEON_TILING_MACRO)
2075 texture = reloc->
robj;
2077 r = r600_cs_packet_next_reloc(p, &reloc);
2079 DRM_ERROR(
"bad SET_RESOURCE\n");
2082 mip_offset = (
u32)((reloc->
lobj.gpu_offset >> 8) & 0xffffffff);
2083 mipmap = reloc->
robj;
2084 r = r600_check_texture_resource(p, idx+(i*7)+1,
2088 reloc->
lobj.tiling_flags);
2091 ib[idx+1+(i*7)+2] += base_offset;
2092 ib[idx+1+(i*7)+3] += mip_offset;
2098 r = r600_cs_packet_next_reloc(p, &reloc);
2100 DRM_ERROR(
"bad SET_RESOURCE\n");
2105 if (p->
rdev && (size + offset) > radeon_bo_size(reloc->
robj)) {
2107 dev_warn(p->
dev,
"vbo resource seems too big (%d) for the bo (%ld)\n",
2108 size + offset, radeon_bo_size(reloc->
robj));
2109 ib[idx+1+(i*7)+1] = radeon_bo_size(reloc->
robj) -
offset;
2113 ib[idx+1+(i*8)+0] = offset64;
2114 ib[idx+1+(i*8)+2] = (ib[idx+1+(i*8)+2] & 0xffffff00) |
2121 DRM_ERROR(
"bad SET_RESOURCE\n");
2129 end_reg = 4 * pkt->
count + start_reg - 4;
2133 DRM_ERROR(
"bad SET_ALU_CONST\n");
2140 end_reg = 4 * pkt->
count + start_reg - 4;
2144 DRM_ERROR(
"bad SET_BOOL_CONST\n");
2150 end_reg = 4 * pkt->
count + start_reg - 4;
2154 DRM_ERROR(
"bad SET_LOOP_CONST\n");
2160 end_reg = 4 * pkt->
count + start_reg - 4;
2164 DRM_ERROR(
"bad SET_CTL_CONST\n");
2169 if (pkt->
count % 3) {
2170 DRM_ERROR(
"bad SET_SAMPLER\n");
2174 end_reg = 4 * pkt->
count + start_reg - 4;
2178 DRM_ERROR(
"bad SET_SAMPLER\n");
2185 DRM_ERROR(
"STRMOUT_BASE_UPDATE only supported on 7xx\n");
2188 if (pkt->
count != 1) {
2189 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE packet count\n");
2192 if (idx_value > 3) {
2193 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE index\n");
2199 r = r600_cs_packet_next_reloc(p, &reloc);
2201 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE reloc\n");
2206 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE, bo does not match\n");
2212 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n",
2217 if ((offset + 4) > radeon_bo_size(reloc->
robj)) {
2218 DRM_ERROR(
"bad STRMOUT_BASE_UPDATE bo too small: 0x%llx, 0x%lx\n",
2219 offset + 4, radeon_bo_size(reloc->
robj));
2222 ib[idx+1] += (
u32)((reloc->
lobj.gpu_offset >> 8) & 0xffffffff);
2227 DRM_ERROR(
"bad SURFACE_BASE_UPDATE\n");
2231 DRM_ERROR(
"bad SURFACE_BASE_UPDATE\n");
2236 if (pkt->
count != 4) {
2237 DRM_ERROR(
"bad STRMOUT_BUFFER_UPDATE (invalid count)\n");
2241 if (idx_value & 0x1) {
2243 r = r600_cs_packet_next_reloc(p, &reloc);
2245 DRM_ERROR(
"bad STRMOUT_BUFFER_UPDATE (missing dst reloc)\n");
2250 if ((offset + 4) > radeon_bo_size(reloc->
robj)) {
2251 DRM_ERROR(
"bad STRMOUT_BUFFER_UPDATE dst bo too small: 0x%llx, 0x%lx\n",
2252 offset + 4, radeon_bo_size(reloc->
robj));
2255 offset += reloc->
lobj.gpu_offset;
2260 if (((idx_value >> 1) & 0x3) == 2) {
2262 r = r600_cs_packet_next_reloc(p, &reloc);
2264 DRM_ERROR(
"bad STRMOUT_BUFFER_UPDATE (missing src reloc)\n");
2269 if ((offset + 4) > radeon_bo_size(reloc->
robj)) {
2270 DRM_ERROR(
"bad STRMOUT_BUFFER_UPDATE src bo too small: 0x%llx, 0x%lx\n",
2271 offset + 4, radeon_bo_size(reloc->
robj));
2274 offset += reloc->
lobj.gpu_offset;
2280 if (pkt->
count != 4) {
2281 DRM_ERROR(
"bad COPY_DW (invalid count)\n");
2284 if (idx_value & 0x1) {
2287 r = r600_cs_packet_next_reloc(p, &reloc);
2289 DRM_ERROR(
"bad COPY_DW (missing src reloc)\n");
2294 if ((offset + 4) > radeon_bo_size(reloc->
robj)) {
2295 DRM_ERROR(
"bad COPY_DW src bo too small: 0x%llx, 0x%lx\n",
2296 offset + 4, radeon_bo_size(reloc->
robj));
2299 offset += reloc->
lobj.gpu_offset;
2305 if (!r600_is_safe_reg(p, reg, idx+1))
2308 if (idx_value & 0x2) {
2311 r = r600_cs_packet_next_reloc(p, &reloc);
2313 DRM_ERROR(
"bad COPY_DW (missing dst reloc)\n");
2318 if ((offset + 4) > radeon_bo_size(reloc->
robj)) {
2319 DRM_ERROR(
"bad COPY_DW dst bo too small: 0x%llx, 0x%lx\n",
2320 offset + 4, radeon_bo_size(reloc->
robj));
2323 offset += reloc->
lobj.gpu_offset;
2329 if (!r600_is_safe_reg(p, reg, idx+3))
2336 DRM_ERROR(
"Packet3 opcode %x not supported\n", pkt->
opcode);
2353 r600_cs_track_init(track);
2355 track->
npipes = p->
rdev->config.r600.tiling_npipes;
2356 track->
nbanks = p->
rdev->config.r600.tiling_nbanks;
2359 track->
npipes = p->
rdev->config.rv770.tiling_npipes;
2360 track->
nbanks = p->
rdev->config.rv770.tiling_nbanks;
2366 r = r600_cs_packet_parse(p, &pkt, p->
idx);
2375 r = r600_cs_parse_packet0(p, &pkt);
2380 r = r600_packet3_check(p, &pkt);
2383 DRM_ERROR(
"Unknown packet type %d !\n", pkt.
type);
2395 for (r = 0; r < p->
ib.length_dw; r++) {
2430 for (i = 0; i < parser->
nchunks; i++) {
2451 r600_cs_track_init(track);
2456 parser.
dev = &dev->pdev->dev;
2463 DRM_ERROR(
"Failed to initialize parser !\n");
2464 r600_cs_parser_fini(&parser, r);
2467 r = r600_cs_parser_relocs_legacy(&parser);
2469 DRM_ERROR(
"Failed to parse relocation !\n");
2470 r600_cs_parser_fini(&parser, r);
2478 *l = parser.
ib.length_dw;
2481 DRM_ERROR(
"Invalid command stream !\n");
2482 r600_cs_parser_fini(&parser, r);
2487 DRM_ERROR(
"Invalid command stream !\n");
2488 r600_cs_parser_fini(&parser, r);
2491 r600_cs_parser_fini(&parser, r);
2497 r600_cs_packet_next_reloc = &r600_cs_packet_next_reloc_nomm;