diff options
author | Jerome Glisse <jglisse@redhat.com> | 2010-01-30 16:59:10 +0100 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2010-01-30 16:59:10 +0100 |
commit | 8b8c4a808a911ef34ba370bebef131ccc88cf9ef (patch) | |
tree | ebfd0f4c5bf95aa60fe10579d06ef51d18665584 | |
parent | 8f62943bec71bba69d51ba7df6463a95ab71e1e4 (diff) |
move clear,blend,fog back to cb_cntl atom
Those color mostly serve when using fmask/cmask buffer or blending
-rw-r--r-- | r600_atom.c | 53 | ||||
-rw-r--r-- | r600_atom_api.h | 22 | ||||
-rw-r--r-- | test.c | 23 |
3 files changed, 44 insertions, 54 deletions
diff --git a/r600_atom.c b/r600_atom.c index 5ff936d..1848d2f 100644 --- a/r600_atom.c +++ b/r600_atom.c @@ -344,7 +344,7 @@ out_err: */ struct r600_cb_cntl { struct radeon_atom atom; - u32 pkts[16]; + u32 pkts[32]; struct r600_atoms *atoms; }; @@ -396,6 +396,26 @@ static int r600_cb_cntl_create(struct radeon_device *rdev, cb_cntl->pkts[cb_cntl->atom.npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 1); cb_cntl->pkts[cb_cntl->atom.npkts++] = 0x00000202; cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_color_control; + /* CB_CLEAR_RED */ + cb_cntl->pkts[cb_cntl->atom.npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 4); + cb_cntl->pkts[cb_cntl->atom.npkts++] = 0x00000048; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_clear_red; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_clear_green; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_clear_blue; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_clear_alpha; + /* CB_BLEND_RED */ + cb_cntl->pkts[cb_cntl->atom.npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 4); + cb_cntl->pkts[cb_cntl->atom.npkts++] = 0x00000105; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_blend_red; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_blend_green; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_blend_blue; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_blend_alpha; + /* CB_FOG_RED */ + cb_cntl->pkts[cb_cntl->atom.npkts++] = PKT3(PKT3_SET_CONTEXT_REG, 3); + cb_cntl->pkts[cb_cntl->atom.npkts++] = 0x00000109; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_fog_red; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_fog_green; + cb_cntl->pkts[cb_cntl->atom.npkts++] = pcb_cntl.cb_fog_blue; *atom = &cb_cntl->atom; fprintf(stderr, "%s %d pkts\n", __func__, (*atom)->npkts); return 0; @@ -1364,23 +1384,6 @@ static int r600_batches_flush_locked(struct radeon_device *rdev, struct r600_bat list_for_each_entry(flush, &batch->pre_flushes, list) { r600_emit_flush(rdev, batches->ib, flush->bo, flush->flags); } - batches->ib->ptr[batches->ib->cpkts++] = PKT3(PKT3_SET_CONTEXT_REG, 4); - batches->ib->ptr[batches->ib->cpkts++] = 0x00000048; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_clear_red; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_clear_green; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_clear_blue; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_clear_alpha; - batches->ib->ptr[batches->ib->cpkts++] = PKT3(PKT3_SET_CONTEXT_REG, 4); - batches->ib->ptr[batches->ib->cpkts++] = 0x00000105; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_blend_red; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_blend_green; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_blend_blue; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_blend_alpha; - batches->ib->ptr[batches->ib->cpkts++] = PKT3(PKT3_SET_CONTEXT_REG, 3); - batches->ib->ptr[batches->ib->cpkts++] = 0x00000109; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_fog_red; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_fog_green; - batches->ib->ptr[batches->ib->cpkts++] = batch->cb_fog_blue; for (i = 0; i < batch->nemit_atoms; i++) { r = batch->emit_atoms[i]->emit(rdev, batch->emit_atoms[i], batch, batches->ib); if (r) @@ -1419,17 +1422,6 @@ int r600_batches_queue(struct radeon_device *rdev, if (r) return r; mutex_lock(&atoms->mutex); - rbatch->cb_clear_alpha = batch->cb_clear_alpha; - rbatch->cb_clear_blue = batch->cb_clear_blue; - rbatch->cb_clear_green = batch->cb_clear_green; - rbatch->cb_clear_red = batch->cb_clear_red; - rbatch->cb_blend_alpha = batch->cb_blend_alpha; - rbatch->cb_blend_blue = batch->cb_blend_blue; - rbatch->cb_blend_green = batch->cb_blend_green; - rbatch->cb_blend_red = batch->cb_blend_red; - rbatch->cb_fog_blue = batch->cb_fog_blue; - rbatch->cb_fog_green = batch->cb_fog_green; - rbatch->cb_fog_red = batch->cb_fog_red; i = 0; if (batch->blend == NULL || batch->cb_cntl == NULL || batch->pa == NULL || batch->vport == NULL || @@ -1494,8 +1486,7 @@ reprocess: radeon_atom_flush_cleanup(&rbatch->pre_flushes); radeon_atom_flush_cleanup(&rbatch->post_flushes); rbatch->nflushes = 0; - /* blend color (6dw) + clear color (6dw) + fog color (5 dw) */ - rbatch->npkts = 17; + rbatch->npkts = 0; /* flush + wait until = 5dw */ rbatch->npkts += 5; for (i = 0; i < R600_BATCH_NATOMS; i++) { diff --git a/r600_atom_api.h b/r600_atom_api.h index 2d8db21..9ad954b 100644 --- a/r600_atom_api.h +++ b/r600_atom_api.h @@ -55,6 +55,17 @@ struct drm_r600_cb_cntl { u32 cb_clrcmp_dst; u32 cb_clrcmp_msk; u32 cb_color_control; + u32 cb_blend_alpha; + u32 cb_blend_blue; + u32 cb_blend_green; + u32 cb_blend_red; + u32 cb_clear_alpha; + u32 cb_clear_blue; + u32 cb_clear_green; + u32 cb_clear_red; + u32 cb_fog_blue; + u32 cb_fog_green; + u32 cb_fog_red; }; /* tp - texture pipe */ @@ -196,17 +207,6 @@ struct drm_r600_vgt { }; struct drm_r600_batch { - u32 cb_blend_alpha; - u32 cb_blend_blue; - u32 cb_blend_green; - u32 cb_blend_red; - u32 cb_clear_alpha; - u32 cb_clear_blue; - u32 cb_clear_green; - u32 cb_clear_red; - u32 cb_fog_blue; - u32 cb_fog_green; - u32 cb_fog_red; struct radeon_atom *vs_constants; struct radeon_atom *ps_constants; struct radeon_atom *blend; @@ -132,6 +132,17 @@ int r600_tri_flat(struct radeon *radeon) cb_cntl.cb_clrcmp_dst = 0x000000ff; cb_cntl.cb_clrcmp_msk = 0xffffffff; cb_cntl.cb_color_control = 0x00cc0000; + cb_cntl.cb_clear_alpha = 0x00000000; + cb_cntl.cb_clear_blue = 0x00000000; + cb_cntl.cb_clear_green = 0x00000000; + cb_cntl.cb_clear_red = 0x00000000; + cb_cntl.cb_blend_alpha = 0x00000000; + cb_cntl.cb_blend_blue = 0x00000000; + cb_cntl.cb_blend_green = 0x00000000; + cb_cntl.cb_blend_red = 0x00000000; + cb_cntl.cb_fog_blue = 0x00000000; + cb_cntl.cb_fog_green = 0x00000000; + cb_cntl.cb_fog_red = 0x00000000; atom.type = R600_ATOM_CB_CNTL; atom.id = 0; atom.data = (uint64_t)(uintptr_t)&cb_cntl; @@ -251,18 +262,6 @@ int r600_tri_flat(struct radeon *radeon) return r; /* batch */ - batch.cb_clear_alpha = 0x00000000; - batch.cb_clear_blue = 0x00000000; - batch.cb_clear_green = 0x00000000; - batch.cb_clear_red = 0x00000000; - batch.cb_blend_alpha = 0x00000000; - batch.cb_blend_blue = 0x00000000; - batch.cb_blend_green = 0x00000000; - batch.cb_blend_red = 0x00000000; - batch.cb_fog_blue = 0x00000000; - batch.cb_fog_green = 0x00000000; - batch.cb_fog_red = 0x00000000; - r = radeon_batches_queue(rdev, &batch); if (r) return r; |