From 9ab0165375ea3e32a02b488ba9f78c460e700cd7 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 26 Jan 2015 16:23:29 +0800 Subject: [PATCH] ilo: update SF_CLIP_VIEWPORT for Gen8 --- .../drivers/ilo/ilo_builder_3d_bottom.h | 19 ++++++++++++----- src/gallium/drivers/ilo/ilo_builder_decode.c | 14 +++++++++++++ src/gallium/drivers/ilo/ilo_render_gen6.c | 21 +++++++++++-------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h index b7766a518f6..b607f561d9e 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h @@ -1056,7 +1056,7 @@ gen7_SF_CLIP_VIEWPORT(struct ilo_builder *builder, uint32_t state_offset, *dw; unsigned i; - ILO_DEV_ASSERT(builder->dev, 7, 7.5); + ILO_DEV_ASSERT(builder->dev, 7, 8); /* * From the Ivy Bridge PRM, volume 2 part 1, page 270: @@ -1084,14 +1084,23 @@ gen7_SF_CLIP_VIEWPORT(struct ilo_builder *builder, dw[5] = fui(vp->m32); dw[6] = 0; dw[7] = 0; + dw[8] = fui(vp->min_gbx); dw[9] = fui(vp->max_gbx); dw[10] = fui(vp->min_gby); dw[11] = fui(vp->max_gby); - dw[12] = 0; - dw[13] = 0; - dw[14] = 0; - dw[15] = 0; + + if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) { + dw[12] = fui(vp->min_x); + dw[13] = fui(vp->max_x - 1.0f); + dw[14] = fui(vp->min_y); + dw[15] = fui(vp->max_y - 1.0f); + } else { + dw[12] = 0; + dw[13] = 0; + dw[14] = 0; + dw[15] = 0; + } dw += 16; } diff --git a/src/gallium/drivers/ilo/ilo_builder_decode.c b/src/gallium/drivers/ilo/ilo_builder_decode.c index 05afe128627..d645f389fad 100644 --- a/src/gallium/drivers/ilo/ilo_builder_decode.c +++ b/src/gallium/drivers/ilo/ilo_builder_decode.c @@ -192,6 +192,20 @@ writer_decode_sf_clip_viewport_gen7(const struct ilo_builder *builder, dw = writer_dw(builder, which, offset, 11, "SF_CLIP VP%d", i); ilo_printf("guardband ymax = %f\n", uif(dw)); + if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) { + dw = writer_dw(builder, which, offset, 12, "SF_CLIP VP%d", i); + ilo_printf("extent xmin = %f\n", uif(dw)); + + dw = writer_dw(builder, which, offset, 13, "SF_CLIP VP%d", i); + ilo_printf("extent xmax = %f\n", uif(dw)); + + dw = writer_dw(builder, which, offset, 14, "SF_CLIP VP%d", i); + ilo_printf("extent ymin = %f\n", uif(dw)); + + dw = writer_dw(builder, which, offset, 15, "SF_CLIP VP%d", i); + ilo_printf("extent ymax = %f\n", uif(dw)); + } + offset += state_size; } } diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c index 40c12724bbd..3f0aa7cf23c 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen6.c +++ b/src/gallium/drivers/ilo/ilo_render_gen6.c @@ -637,16 +637,19 @@ gen6_draw_clip(struct ilo_render *r, unsigned i; /* - * We do not do 2D clipping yet. Guard band test should only be enabled - * when the viewport is larger than the framebuffer. + * Gen8+ has viewport extent test. Guard band test can be enabled on + * prior Gens only when the viewport is larger than the framebuffer, + * unless we emulate viewport extent test on them. */ - for (i = 0; i < vec->viewport.count; i++) { - const struct ilo_viewport_cso *vp = &vec->viewport.cso[i]; - - if (vp->min_x > 0.0f || vp->max_x < vec->fb.state.width || - vp->min_y > 0.0f || vp->max_y < vec->fb.state.height) { - enable_guardband = false; - break; + if (ilo_dev_gen(r->dev) < ILO_GEN(8)) { + for (i = 0; i < vec->viewport.count; i++) { + const struct ilo_viewport_cso *vp = &vec->viewport.cso[i]; + + if (vp->min_x > 0.0f || vp->max_x < vec->fb.state.width || + vp->min_y > 0.0f || vp->max_y < vec->fb.state.height) { + enable_guardband = false; + break; + } } } -- 2.30.2