diff options
Diffstat (limited to 'r600_atom.c')
-rw-r--r-- | r600_atom.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/r600_atom.c b/r600_atom.c index 4e90568..62af283 100644 --- a/r600_atom.c +++ b/r600_atom.c @@ -649,15 +649,9 @@ int r600_vs_shader_emit(struct radeon_device *rdev, void *data, struct radeon_ib *ib) { - struct drm_r600_vs_shader *vs_shader = atom->state; - struct r600_batch *batch = (struct r600_batch *)data; - u32 *opcodes = batch->shaders->ptr, ndwords; int r; - memcpy(&opcodes[batch->shaders_idx], vs_shader->opcodes, vs_shader->ndwords * 4); - atom->pkts[2] = batch->shaders_idx >> 6; - atom->pkts[4] = radeon_ib_reloc(ib, batch->shaders, RADEON_GEM_DOMAIN_GTT); - batch->shaders_idx += (vs_shader->ndwords + 63) & 0xFFFFFFC0; + atom->pkts[4] = radeon_ib_reloc(ib, atom->bo[0], RADEON_GEM_DOMAIN_GTT); r = radeon_ib_copy(ib, atom->pkts, atom->npkts); return r; } @@ -672,11 +666,18 @@ int r600_vs_shader_create(struct radeon_device *rdev, struct radeon_atom *atom, if (vs_shader == NULL) return -ENOMEM; memcpy(vs_shader, data, sizeof(struct drm_r600_vs_shader)); + atom->bo[0] = radeon_bo_lookup(rdev, vs_shader->handle); + atom->flags[0] = 0x08000000; + if (atom->bo[0] == NULL) { + return -EINVAL; + } + atom->nbo = 1; + atom->nflushes = 1; atom->state = vs_shader; /* SQ_PGM_START_VS */ atom->pkts[atom->npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 1); atom->pkts[atom->npkts++] = 0x00000216; - atom->pkts[atom->npkts++] = 0x00000000; + atom->pkts[atom->npkts++] = vs_shader->offset; atom->pkts[atom->npkts++] = PKT3(PKT3_NOP, 0); atom->pkts[atom->npkts++] = 0x00000000; /* SQ_PGM_RESOURCES_VS */ @@ -725,15 +726,9 @@ int r600_ps_shader_emit(struct radeon_device *rdev, void *data, struct radeon_ib *ib) { - struct drm_r600_ps_shader *ps_shader = atom->state; - struct r600_batch *batch = (struct r600_batch *)data; - u32 *opcodes = batch->shaders->ptr; int r; - memcpy(&opcodes[batch->shaders_idx], ps_shader->opcodes, ps_shader->ndwords * 4); - atom->pkts[2] = batch->shaders_idx >> 6; - atom->pkts[4] = radeon_ib_reloc(ib, batch->shaders, RADEON_GEM_DOMAIN_GTT); - batch->shaders_idx += (ps_shader->ndwords + 63) & 0xFFFFFFC0; + atom->pkts[4] = radeon_ib_reloc(ib, atom->bo[0], RADEON_GEM_DOMAIN_GTT); r = radeon_ib_copy(ib, atom->pkts, atom->npkts); return r; } @@ -749,10 +744,17 @@ int r600_ps_shader_create(struct radeon_device *rdev, struct radeon_atom *atom, return -ENOMEM; memcpy(ps_shader, data, sizeof(struct drm_r600_ps_shader)); atom->state = ps_shader; + atom->bo[0] = radeon_bo_lookup(rdev, ps_shader->handle); + atom->flags[0] = 0x08000000; + if (atom->bo[0] == NULL) { + return -EINVAL; + } + atom->nbo = 1; + atom->nflushes = 1; /* SQ_PGM_START_PS */ atom->pkts[atom->npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 1); atom->pkts[atom->npkts++] = 0x00000210; - atom->pkts[atom->npkts++] = 0x00000000; + atom->pkts[atom->npkts++] = ps_shader->offset; atom->pkts[atom->npkts++] = PKT3(PKT3_NOP, 0); atom->pkts[atom->npkts++] = 0x00000000; /* SQ_PGM_RESOURCES_PS */ |