diff options
Diffstat (limited to 'drivers/char/drm/r300_cmdbuf.c')
-rw-r--r-- | drivers/char/drm/r300_cmdbuf.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index 59b2944811c5..8cd82710f6a0 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -486,7 +486,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | |||
486 | if (cmd[0] & 0x8000) { | 486 | if (cmd[0] & 0x8000) { |
487 | u32 offset; | 487 | u32 offset; |
488 | 488 | ||
489 | if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL | 489 | if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
490 | | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { | 490 | | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { |
491 | offset = cmd[2] << 10; | 491 | offset = cmd[2] << 10; |
492 | ret = !radeon_check_offset(dev_priv, offset); | 492 | ret = !radeon_check_offset(dev_priv, offset); |
@@ -504,7 +504,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | |||
504 | DRM_ERROR("Invalid bitblt second offset is %08X\n", offset); | 504 | DRM_ERROR("Invalid bitblt second offset is %08X\n", offset); |
505 | return -EINVAL; | 505 | return -EINVAL; |
506 | } | 506 | } |
507 | 507 | ||
508 | } | 508 | } |
509 | } | 509 | } |
510 | 510 | ||
@@ -723,54 +723,54 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, | |||
723 | u32 *ref_age_base; | 723 | u32 *ref_age_base; |
724 | u32 i, buf_idx, h_pending; | 724 | u32 i, buf_idx, h_pending; |
725 | RING_LOCALS; | 725 | RING_LOCALS; |
726 | 726 | ||
727 | if (cmdbuf->bufsz < | 727 | if (cmdbuf->bufsz < |
728 | (sizeof(u64) + header.scratch.n_bufs * sizeof(buf_idx))) { | 728 | (sizeof(u64) + header.scratch.n_bufs * sizeof(buf_idx))) { |
729 | return -EINVAL; | 729 | return -EINVAL; |
730 | } | 730 | } |
731 | 731 | ||
732 | if (header.scratch.reg >= 5) { | 732 | if (header.scratch.reg >= 5) { |
733 | return -EINVAL; | 733 | return -EINVAL; |
734 | } | 734 | } |
735 | 735 | ||
736 | dev_priv->scratch_ages[header.scratch.reg]++; | 736 | dev_priv->scratch_ages[header.scratch.reg]++; |
737 | 737 | ||
738 | ref_age_base = (u32 *)(unsigned long)*((uint64_t *)cmdbuf->buf); | 738 | ref_age_base = (u32 *)(unsigned long)*((uint64_t *)cmdbuf->buf); |
739 | 739 | ||
740 | cmdbuf->buf += sizeof(u64); | 740 | cmdbuf->buf += sizeof(u64); |
741 | cmdbuf->bufsz -= sizeof(u64); | 741 | cmdbuf->bufsz -= sizeof(u64); |
742 | 742 | ||
743 | for (i=0; i < header.scratch.n_bufs; i++) { | 743 | for (i=0; i < header.scratch.n_bufs; i++) { |
744 | buf_idx = *(u32 *)cmdbuf->buf; | 744 | buf_idx = *(u32 *)cmdbuf->buf; |
745 | buf_idx *= 2; /* 8 bytes per buf */ | 745 | buf_idx *= 2; /* 8 bytes per buf */ |
746 | 746 | ||
747 | if (DRM_COPY_TO_USER(ref_age_base + buf_idx, &dev_priv->scratch_ages[header.scratch.reg], sizeof(u32))) { | 747 | if (DRM_COPY_TO_USER(ref_age_base + buf_idx, &dev_priv->scratch_ages[header.scratch.reg], sizeof(u32))) { |
748 | return -EINVAL; | 748 | return -EINVAL; |
749 | } | 749 | } |
750 | 750 | ||
751 | if (DRM_COPY_FROM_USER(&h_pending, ref_age_base + buf_idx + 1, sizeof(u32))) { | 751 | if (DRM_COPY_FROM_USER(&h_pending, ref_age_base + buf_idx + 1, sizeof(u32))) { |
752 | return -EINVAL; | 752 | return -EINVAL; |
753 | } | 753 | } |
754 | 754 | ||
755 | if (h_pending == 0) { | 755 | if (h_pending == 0) { |
756 | return -EINVAL; | 756 | return -EINVAL; |
757 | } | 757 | } |
758 | 758 | ||
759 | h_pending--; | 759 | h_pending--; |
760 | 760 | ||
761 | if (DRM_COPY_TO_USER(ref_age_base + buf_idx + 1, &h_pending, sizeof(u32))) { | 761 | if (DRM_COPY_TO_USER(ref_age_base + buf_idx + 1, &h_pending, sizeof(u32))) { |
762 | return -EINVAL; | 762 | return -EINVAL; |
763 | } | 763 | } |
764 | 764 | ||
765 | cmdbuf->buf += sizeof(buf_idx); | 765 | cmdbuf->buf += sizeof(buf_idx); |
766 | cmdbuf->bufsz -= sizeof(buf_idx); | 766 | cmdbuf->bufsz -= sizeof(buf_idx); |
767 | } | 767 | } |
768 | 768 | ||
769 | BEGIN_RING(2); | 769 | BEGIN_RING(2); |
770 | OUT_RING( CP_PACKET0( RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0 ) ); | 770 | OUT_RING( CP_PACKET0( RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0 ) ); |
771 | OUT_RING( dev_priv->scratch_ages[header.scratch.reg] ); | 771 | OUT_RING( dev_priv->scratch_ages[header.scratch.reg] ); |
772 | ADVANCE_RING(); | 772 | ADVANCE_RING(); |
773 | 773 | ||
774 | return 0; | 774 | return 0; |
775 | } | 775 | } |
776 | 776 | ||
@@ -919,7 +919,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
919 | goto cleanup; | 919 | goto cleanup; |
920 | } | 920 | } |
921 | break; | 921 | break; |
922 | 922 | ||
923 | default: | 923 | default: |
924 | DRM_ERROR("bad cmd_type %i at %p\n", | 924 | DRM_ERROR("bad cmd_type %i at %p\n", |
925 | header.header.cmd_type, | 925 | header.header.cmd_type, |