diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-12-04 12:52:50 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-12-04 13:07:51 +0000 |
commit | 626dd1324dd2c5b14ca4aff598b5eb1e45550e69 (patch) | |
tree | 114aa95d2d3072f376f7c9bb74081877a204efa7 /src | |
parent | dbdb8fabfbade3f19fd8af3524468b5e6668bb66 (diff) |
sna/gen4: Workaround render corruption with multiple SF threads
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57410
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/gen4_render.c | 33 | ||||
-rw-r--r-- | src/sna/sna_render.h | 1 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index fb1c742e..4e8ad578 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1256,7 +1256,7 @@ gen4_emit_pipelined_pointers(struct sna *sna, bp = gen4_get_blend(blend, op->has_component_alpha, op->dst.format); DBG(("%s: sp=%d, bp=%d\n", __FUNCTION__, sp, bp)); - key = sp | (uint32_t)bp << 16; + key = sp | (uint32_t)bp << 16 | op->u.gen4.sf << 31; if (key == sna->render_state.gen4.last_pipelined_pointers) return; @@ -1264,7 +1264,7 @@ gen4_emit_pipelined_pointers(struct sna *sna, OUT_BATCH(sna->render_state.gen4.vs); OUT_BATCH(GEN4_GS_DISABLE); /* passthrough */ OUT_BATCH(GEN4_CLIP_DISABLE); /* passthrough */ - OUT_BATCH(sna->render_state.gen4.sf[1]); + OUT_BATCH(sna->render_state.gen4.sf[op->u.gen4.sf]); OUT_BATCH(sna->render_state.gen4.wm + sp); OUT_BATCH(sna->render_state.gen4.cc + bp); @@ -2339,6 +2339,7 @@ gen4_render_composite(struct sna *sna, tmp->is_affine = tmp->src.is_affine; tmp->has_component_alpha = false; tmp->need_magic_ca_pass = false; + tmp->u.gen4.sf = 0; tmp->prim_emit = gen4_emit_composite_primitive; if (mask) { @@ -2391,11 +2392,13 @@ gen4_render_composite(struct sna *sna, tmp->floats_per_vertex = 5 + 2 * !tmp->is_affine; } else { - if (tmp->src.is_solid) + if (tmp->src.is_solid) { tmp->prim_emit = gen4_emit_composite_primitive_solid; - else if (tmp->src.transform == NULL) + } else if (tmp->src.transform == NULL) { tmp->prim_emit = gen4_emit_composite_primitive_identity_source; - else if (tmp->src.is_affine) + /* XXX using more then one thread causes corruption? */ + tmp->u.gen4.sf = 1; + } else if (tmp->src.is_affine) tmp->prim_emit = gen4_emit_composite_primitive_affine_source; tmp->floats_per_vertex = 3 + !tmp->is_affine; @@ -2715,6 +2718,7 @@ gen4_render_composite_spans(struct sna *sna, tmp->base.u.gen4.wm_kernel = WM_KERNEL_OPACITY | !tmp->base.is_affine; tmp->base.u.gen4.ve_id = 1 << 1 | tmp->base.is_affine; + tmp->base.u.gen4.sf = 0; tmp->box = gen4_render_composite_spans_box; tmp->boxes = gen4_render_composite_spans_boxes; @@ -2925,6 +2929,7 @@ fallback_blt: tmp.floats_per_rect = 9; tmp.u.gen4.wm_kernel = WM_KERNEL; tmp.u.gen4.ve_id = 1; + tmp.u.gen4.sf = 0; if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL)) { kgem_submit(&sna->kgem); @@ -3057,6 +3062,7 @@ fallback: op->base.floats_per_rect = 9; op->base.u.gen4.wm_kernel = WM_KERNEL; op->base.u.gen4.ve_id = 1; + op->base.u.gen4.sf = 0; if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL)) { kgem_submit(&sna->kgem); @@ -3179,6 +3185,7 @@ gen4_render_fill_boxes(struct sna *sna, tmp.floats_per_rect = 9; tmp.u.gen4.wm_kernel = WM_KERNEL; tmp.u.gen4.ve_id = 1; + tmp.u.gen4.sf = 0; if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) { kgem_submit(&sna->kgem); @@ -3284,6 +3291,7 @@ gen4_render_fill(struct sna *sna, uint8_t alu, op->base.floats_per_rect = 9; op->base.u.gen4.wm_kernel = WM_KERNEL; op->base.u.gen4.ve_id = 1; + op->base.u.gen4.sf = 0; if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) { kgem_submit(&sna->kgem); @@ -3363,6 +3371,7 @@ gen4_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo, tmp.u.gen4.wm_kernel = WM_KERNEL; tmp.u.gen4.ve_id = 1; + tmp.u.gen4.sf = 0; if (!kgem_check_bo(&sna->kgem, bo, NULL)) { _kgem_submit(&sna->kgem); @@ -3461,7 +3470,8 @@ static uint32_t gen4_create_vs_unit_state(struct sna_static_stream *stream) } static uint32_t gen4_create_sf_state(struct sna_static_stream *stream, - int gen, uint32_t kernel) + int gen, uint32_t kernel, + bool single_thread) { struct gen4_sf_unit_state *sf; @@ -3475,7 +3485,7 @@ static uint32_t gen4_create_sf_state(struct sna_static_stream *stream, /* don't smash vertex header, read start from dw8 */ sf->thread3.urb_entry_read_offset = 1; sf->thread3.dispatch_grf_start_reg = 3; - sf->thread4.max_threads = GEN4_MAX_SF_THREADS - 1; + sf->thread4.max_threads = single_thread ? 0 : GEN4_MAX_SF_THREADS - 1; sf->thread4.urb_entry_allocation_size = URB_SF_ENTRY_SIZE - 1; sf->thread4.nr_urb_entries = URB_SF_ENTRIES; sf->sf5.viewport_transform = false; /* skip viewport */ @@ -3590,7 +3600,7 @@ static bool gen4_render_setup(struct sna *sna) struct gen4_render_state *state = &sna->render_state.gen4; struct sna_static_stream general; struct gen4_wm_unit_state_padded *wm_state; - uint32_t sf[2], wm[KERNEL_COUNT]; + uint32_t sf, wm[KERNEL_COUNT]; int i, j, k, l, m; sna_static_stream_init(&general); @@ -3600,8 +3610,7 @@ static bool gen4_render_setup(struct sna *sna) */ null_create(&general); - sf[0] = sna_static_stream_compile_sf(sna, &general, brw_sf_kernel__nomask); - sf[1] = sna_static_stream_compile_sf(sna, &general, brw_sf_kernel__mask); + sf = sna_static_stream_compile_sf(sna, &general, brw_sf_kernel__mask); for (m = 0; m < KERNEL_COUNT; m++) { if (wm_kernels[m].size) { wm[m] = sna_static_stream_add(&general, @@ -3616,8 +3625,8 @@ static bool gen4_render_setup(struct sna *sna) } state->vs = gen4_create_vs_unit_state(&general); - state->sf[0] = gen4_create_sf_state(&general, sna->kgem.gen, sf[0]); - state->sf[1] = gen4_create_sf_state(&general, sna->kgem.gen, sf[1]); + state->sf[0] = gen4_create_sf_state(&general, sna->kgem.gen, sf, false); + state->sf[1] = gen4_create_sf_state(&general, sna->kgem.gen, sf, true); wm_state = sna_static_stream_map(&general, sizeof(*wm_state) * KERNEL_COUNT * diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h index e056e3fb..a2281f47 100644 --- a/src/sna/sna_render.h +++ b/src/sna/sna_render.h @@ -119,6 +119,7 @@ struct sna_composite_op { struct { int wm_kernel; int ve_id; + int sf; } gen4; struct { |