summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-03-21 16:59:52 +1000
committerDave Airlie <airlied@redhat.com>2008-03-21 16:59:52 +1000
commit36e11dd3801734ff5af9f5edb7aa698f0e2c49c2 (patch)
treef7a9124c0d5b37b29bbc6e1e680728f284d0d1f6 /shared-core
parent316979356f05796c5bd5a47dfc29fe48d6874b49 (diff)
r500: fragment program upload is also used to upload constants.
Limit frag address to 8 bits
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/r300_cmdbuf.c28
-rw-r--r--shared-core/radeon_drm.h5
2 files changed, 24 insertions, 9 deletions
diff --git a/shared-core/r300_cmdbuf.c b/shared-core/r300_cmdbuf.c
index 040a3639..1ae2e677 100644
--- a/shared-core/r300_cmdbuf.c
+++ b/shared-core/r300_cmdbuf.c
@@ -804,26 +804,38 @@ static __inline__ int r300_emit_r500fp(drm_radeon_private_t *dev_priv,
{
int sz;
int addr;
+ int type;
+ int clamp;
+ int stride;
RING_LOCALS;
sz = header.r500fp.count;
- addr = (header.r500fp.adrhi << 8) | header.r500fp.adrlo;
+ /* address is 9 bits 0 - 8, bit 1 of flags is part of address */
+ addr = ((header.r500fp.adrhi_flags & 1) << 8) | header.r500fp.adrlo;
- DRM_DEBUG("r500fp %d %d\n", sz, addr);
+ type = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE);
+ clamp = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP);
+
+ addr |= (type << 16);
+ addr |= (clamp << 17);
+
+ stride = type ? 4 : 6;
+
+ DRM_DEBUG("r500fp %d %d type: %d\n", sz, addr, type);
if (!sz)
return 0;
- if (sz * 6 * 4 > cmdbuf->bufsz)
+ if (sz * stride * 4 > cmdbuf->bufsz)
return -EINVAL;
- BEGIN_RING(3 + sz * 6);
+ BEGIN_RING(3 + sz * stride);
OUT_RING_REG(R500_GA_US_VECTOR_INDEX, addr);
- OUT_RING(CP_PACKET0_TABLE(R500_GA_US_VECTOR_DATA, sz * 6 - 1));
- OUT_RING_TABLE((int *)cmdbuf->buf, sz * 6);
+ OUT_RING(CP_PACKET0_TABLE(R500_GA_US_VECTOR_DATA, sz * stride - 1));
+ OUT_RING_TABLE((int *)cmdbuf->buf, sz * stride);
ADVANCE_RING();
- cmdbuf->buf += sz * 6 * 4;
- cmdbuf->bufsz -= sz * 6 * 4;
+ cmdbuf->buf += sz * stride * 4;
+ cmdbuf->bufsz -= sz * stride * 4;
return 0;
}
diff --git a/shared-core/radeon_drm.h b/shared-core/radeon_drm.h
index 3437320f..c4d9cc6b 100644
--- a/shared-core/radeon_drm.h
+++ b/shared-core/radeon_drm.h
@@ -258,7 +258,7 @@ typedef union {
unsigned char cmd_type, reg, n_bufs, flags;
} scratch;
struct {
- unsigned char cmd_type, count, adrlo, adrhi;
+ unsigned char cmd_type, count, adrlo, adrhi_flags;
} r500fp;
} drm_r300_cmd_header_t;
@@ -270,6 +270,9 @@ typedef union {
#define RADEON_USE_HIERZ 0x40000000
#define RADEON_USE_COMP_ZBUF 0x20000000
+#define R500FP_CONSTANT_TYPE (1 << 1)
+#define R500FP_CONSTANT_CLAMP (1 << 2)
+
/* Primitive types
*/
#define RADEON_POINTS 0x1