- /* Sanity check that we haven't over-allocated. */
- assert(push_constant_chunks + vs_chunks + gs_chunks <= urb_chunks);
-
- /* Finally, compute the number of entries that can fit in the space
- * allocated to each stage.
- */
- unsigned nr_vs_entries = vs_chunks * chunk_size_bytes / vs_entry_size_bytes;
- unsigned nr_gs_entries = gs_chunks * chunk_size_bytes / gs_entry_size_bytes;
-
- /* Since we rounded up when computing *_wants, this may be slightly more
- * than the maximum allowed amount, so correct for that.
- */
- nr_vs_entries = MIN2(nr_vs_entries, brw->urb.max_vs_entries);
- nr_gs_entries = MIN2(nr_gs_entries, brw->urb.max_gs_entries);
-
- /* Ensure that we program a multiple of the granularity. */
- nr_vs_entries = ROUND_DOWN_TO(nr_vs_entries, vs_granularity);
- nr_gs_entries = ROUND_DOWN_TO(nr_gs_entries, gs_granularity);
-
- /* Finally, sanity check to make sure we have at least the minimum number
- * of entries needed for each stage.
- */
- assert(nr_vs_entries >= brw->urb.min_vs_entries);
- if (gs_present)
- assert(nr_gs_entries >= 2);
-
- /* Gen7 doesn't actually use brw->urb.nr_{vs,gs}_entries, but it seems
- * better to put reasonable data in there rather than leave them
- * uninitialized.
- */
- brw->urb.nr_vs_entries = nr_vs_entries;
- brw->urb.nr_gs_entries = nr_gs_entries;
-
- /* Lay out the URB in the following order:
- * - push constants
- * - VS
- * - GS
- */
- brw->urb.vs_start = push_constant_chunks;
- brw->urb.gs_start = push_constant_chunks + vs_chunks;
-
- gen7_emit_vs_workaround_flush(brw);
- gen7_emit_urb_state(brw,
- brw->urb.nr_vs_entries, vs_size, brw->urb.vs_start,
- brw->urb.nr_gs_entries, gs_size, brw->urb.gs_start);
-}
-
-void
-gen7_emit_urb_state(struct brw_context *brw,
- unsigned nr_vs_entries, unsigned vs_size,
- unsigned vs_start, unsigned nr_gs_entries,
- unsigned gs_size, unsigned gs_start)
-{