+
+/* There can be up to 4 different MS levels (1, 2, 4, 8). To simplify the
+ * shader logic, allow each one to take up 8 offsets.
+ */
+#define COMBINE(x, y) x, y
+#define DUMMY 0, 0
+static const uint32_t msaa_sample_xy_offsets[] = {
+ /* MS1 */
+ COMBINE(0, 0),
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+
+ /* MS2 */
+ COMBINE(0, 0),
+ COMBINE(1, 0),
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+
+ /* MS4 */
+ COMBINE(0, 0),
+ COMBINE(1, 0),
+ COMBINE(0, 1),
+ COMBINE(1, 1),
+ DUMMY,
+ DUMMY,
+ DUMMY,
+ DUMMY,
+
+ /* MS8 */
+ COMBINE(0, 0),
+ COMBINE(1, 0),
+ COMBINE(0, 1),
+ COMBINE(1, 1),
+ COMBINE(2, 0),
+ COMBINE(3, 0),
+ COMBINE(2, 1),
+ COMBINE(3, 1),
+};
+
+void nv50_upload_ms_info(struct nouveau_pushbuf *push)
+{
+ BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
+ PUSH_DATA (push, (NV50_CB_AUX_MS_OFFSET << (8 - 2)) | NV50_CB_AUX);
+ BEGIN_NI04(push, NV50_3D(CB_DATA(0)), Elements(msaa_sample_xy_offsets));
+ PUSH_DATAp(push, msaa_sample_xy_offsets, Elements(msaa_sample_xy_offsets));
+}