aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-02-28 01:11:48 -0500
committerDave Airlie <airlied@redhat.com>2011-03-01 00:00:40 -0500
commit2a19cac8f9abf66c3b7b3b6e741b967570773215 (patch)
tree8710bdadcec48d0825c22768d74fc3de5a08ff43
parentaf50621a18418a7a0a71b0b4f60ce74b37967b9e (diff)
drm/r600: parse the set predication command. (v2)
This is required for NV_conditional_render and EXT_transform_feedback. v2: add evergreen support. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c31
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c32
2 files changed, 63 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 345a75a03c96..5c84fca00d36 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -942,6 +942,37 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
942 idx_value = radeon_get_ib_value(p, idx); 942 idx_value = radeon_get_ib_value(p, idx);
943 943
944 switch (pkt->opcode) { 944 switch (pkt->opcode) {
945 case PACKET3_SET_PREDICATION:
946 {
947 int pred_op;
948 int tmp;
949 if (pkt->count != 1) {
950 DRM_ERROR("bad SET PREDICATION\n");
951 return -EINVAL;
952 }
953
954 tmp = radeon_get_ib_value(p, idx + 1);
955 pred_op = (tmp >> 16) & 0x7;
956
957 /* for the clear predicate operation */
958 if (pred_op == 0)
959 return 0;
960
961 if (pred_op > 2) {
962 DRM_ERROR("bad SET PREDICATION operation %d\n", pred_op);
963 return -EINVAL;
964 }
965
966 r = evergreen_cs_packet_next_reloc(p, &reloc);
967 if (r) {
968 DRM_ERROR("bad SET PREDICATION\n");
969 return -EINVAL;
970 }
971
972 ib[idx + 0] = idx_value + (u32)(reloc->lobj.gpu_offset & 0xffffffff);
973 ib[idx + 1] = tmp + (upper_32_bits(reloc->lobj.gpu_offset) & 0xff);
974 }
975 break;
945 case PACKET3_CONTEXT_CONTROL: 976 case PACKET3_CONTEXT_CONTROL:
946 if (pkt->count != 1) { 977 if (pkt->count != 1) {
947 DRM_ERROR("bad CONTEXT_CONTROL\n"); 978 DRM_ERROR("bad CONTEXT_CONTROL\n");
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 6701fa4e41fa..fe0c8eb76010 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1415,6 +1415,38 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
1415 idx_value = radeon_get_ib_value(p, idx); 1415 idx_value = radeon_get_ib_value(p, idx);
1416 1416
1417 switch (pkt->opcode) { 1417 switch (pkt->opcode) {
1418 case PACKET3_SET_PREDICATION:
1419 {
1420 int pred_op;
1421 int tmp;
1422 if (pkt->count != 1) {
1423 DRM_ERROR("bad SET PREDICATION\n");
1424 return -EINVAL;
1425 }
1426
1427 tmp = radeon_get_ib_value(p, idx + 1);
1428 pred_op = (tmp >> 16) & 0x7;
1429
1430 /* for the clear predicate operation */
1431 if (pred_op == 0)
1432 return 0;
1433
1434 if (pred_op > 2) {
1435 DRM_ERROR("bad SET PREDICATION operation %d\n", pred_op);
1436 return -EINVAL;
1437 }
1438
1439 r = r600_cs_packet_next_reloc(p, &reloc);
1440 if (r) {
1441 DRM_ERROR("bad SET PREDICATION\n");
1442 return -EINVAL;
1443 }
1444
1445 ib[idx + 0] = idx_value + (u32)(reloc->lobj.gpu_offset & 0xffffffff);
1446 ib[idx + 1] = tmp + (upper_32_bits(reloc->lobj.gpu_offset) & 0xff);
1447 }
1448 break;
1449
1418 case PACKET3_START_3D_CMDBUF: 1450 case PACKET3_START_3D_CMDBUF:
1419 if (p->family >= CHIP_RV770 || pkt->count) { 1451 if (p->family >= CHIP_RV770 || pkt->count) {
1420 DRM_ERROR("bad START_3D\n"); 1452 DRM_ERROR("bad START_3D\n");