ilo: update SF_CLIP_VIEWPORT for Gen8
authorChia-I Wu <olvaffe@gmail.com>
Mon, 26 Jan 2015 08:23:29 +0000 (16:23 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 11 Feb 2015 23:56:11 +0000 (07:56 +0800)
src/gallium/drivers/ilo/ilo_builder_3d_bottom.h
src/gallium/drivers/ilo/ilo_builder_decode.c
src/gallium/drivers/ilo/ilo_render_gen6.c

index b7766a518f6ed0d9753c690199ee65a56ecfb368..b607f561d9e9a6cd00f05ef208293be76aa1e80f 100644 (file)
@@ -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;
    }
index 05afe12862719b22f8be080592d6474210fd259e..d645f389fad2b4d339a500125d9d76de9ce2443d 100644 (file)
@@ -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;
    }
 }
index 40c12724bbd560b3977132021ad39b6fb113f12a..3f0aa7cf23cc5e3227cf7e253f949cee2bc5b687 100644 (file)
@@ -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;
+            }
          }
       }