From: Chia-I Wu Date: Sat, 20 Sep 2014 03:21:20 +0000 (+0800) Subject: ilo: add a helper for RECTLIST blitter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b4726d32e2ac28360641c40650630d6c6317133;p=mesa.git ilo: add a helper for RECTLIST blitter Add ilo_3d_draw_rectlist() for use by RECTLIST blitter. --- diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index cf2c4837419..f0aee2f480b 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -200,7 +200,7 @@ ilo_3d_pause_queries(struct ilo_3d *hw3d) } } -void +static void ilo_3d_own_render_ring(struct ilo_3d *hw3d) { ilo_cp_set_owner(hw3d->cp, INTEL_RING_RENDER, &hw3d->owner); @@ -539,6 +539,45 @@ ilo_3d_pass_render_condition(struct ilo_context *ilo) return true; } +void +ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter) +{ + ilo_3d_own_render_ring(hw3d); + + /* + * From the Sandy Bridge PRM, volume 2 part 1, page 313: + * + * "If other rendering operations have preceded this clear, a + * PIPE_CONTROL with write cache flush enabled and Z-inhibit + * disabled must be issued before the rectangle primitive used for + * the depth buffer clear operation." + * + * From the Sandy Bridge PRM, volume 2 part 1, page 314: + * + * "Depth buffer clear pass must be followed by a PIPE_CONTROL + * command with DEPTH_STALL bit set and Then followed by Depth + * FLUSH" + * + * But the pipeline has to be flushed both before and after not only + * because of these workarounds. We need them for reasons such as + * + * - we may sample from a texture that was rendered to + * - we may sample from the fb shortly after + * + * Skip checking blitter->op and do the flushes. + * + * XXX need space check + */ + if (!hw3d->new_batch) + ilo_3d_pipeline_emit_flush(hw3d->pipeline); + + ilo_3d_pipeline_emit_rectlist(hw3d->pipeline, blitter); + + ilo_3d_pipeline_emit_flush(hw3d->pipeline); + + hw3d->new_batch = false; +} + #define UPDATE_MIN2(a, b) (a) = MIN2((a), (b)) #define UPDATE_MAX2(a, b) (a) = MAX2((a), (b)) diff --git a/src/gallium/drivers/ilo/ilo_3d.h b/src/gallium/drivers/ilo/ilo_3d.h index ccc57cd12a7..ff3a59e3584 100644 --- a/src/gallium/drivers/ilo/ilo_3d.h +++ b/src/gallium/drivers/ilo/ilo_3d.h @@ -32,6 +32,7 @@ #include "ilo_cp.h" struct ilo_3d_pipeline; +struct ilo_blitter; struct ilo_context; struct ilo_query; @@ -69,7 +70,7 @@ void ilo_3d_cp_submitted(struct ilo_3d *hw3d); void -ilo_3d_own_render_ring(struct ilo_3d *hw3d); +ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter); void ilo_3d_begin_query(struct ilo_context *ilo, struct ilo_query *q); diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c index ced28518ebd..eabb483f63d 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c +++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c @@ -304,42 +304,12 @@ hiz_align_fb(struct ilo_blitter *blitter) static void hiz_emit_rectlist(struct ilo_blitter *blitter) { - struct ilo_3d *hw3d = blitter->ilo->hw3d; - struct ilo_3d_pipeline *p = hw3d->pipeline; - hiz_align_fb(blitter); ilo_blitter_set_rectlist(blitter, 0, 0, blitter->fb.width, blitter->fb.height); - ilo_3d_own_render_ring(hw3d); - - /* - * From the Sandy Bridge PRM, volume 2 part 1, page 313: - * - * "If other rendering operations have preceded this clear, a - * PIPE_CONTROL with write cache flush enabled and Z-inhibit - * disabled must be issued before the rectangle primitive used for - * the depth buffer clear operation." - * - * From the Sandy Bridge PRM, volume 2 part 1, page 314: - * - * "Depth buffer clear pass must be followed by a PIPE_CONTROL - * command with DEPTH_STALL bit set and Then followed by Depth - * FLUSH" - * - * But the pipeline has to be flushed both before and after not only - * because of these workarounds. We need them for reasons such as - * - * - we may sample from a texture that was rendered to - * - we may sample from the fb shortly after - */ - if (ilo_builder_batch_used(&p->cp->builder)) - ilo_3d_pipeline_emit_flush(p); - - ilo_3d_pipeline_emit_rectlist(p, blitter); - - ilo_3d_pipeline_emit_flush(p); + ilo_3d_draw_rectlist(blitter->ilo->hw3d, blitter); } static bool