101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell/**************************************************************************
201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * All Rights Reserved.
501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * copy of this software and associated documentation files (the
801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * "Software"), to deal in the Software without restriction, including
901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
1001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
1101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * permit persons to whom the Software is furnished to do so, subject to
1201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * the following conditions:
1301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
1401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * The above copyright notice and this permission notice (including the
1501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * next paragraph) shall be included in all copies or substantial portions
1601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * of the Software.
1701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
1801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
2201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
2601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell **************************************************************************/
2701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
28d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
294f25420bdd834e81a3e22733304efc5261c2998aBrian Paul#include "util/u_memory.h"
30846b7fbc6c9cbd57eed01bd04b1da73109935091Brian#include "pipe/p_shader_tokens.h"
316acd63a4980951727939c0dd545a0324965b3834José Fonseca#include "draw/draw_context.h"
326acd63a4980951727939c0dd545a0324965b3834José Fonseca#include "draw/draw_vertex.h"
3301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell#include "i915_context.h"
3401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell#include "i915_state.h"
35abbb1bde06990cb15c82ebcdb9ac07b00cb0ab4fJakob Bornecrantz#include "i915_debug.h"
36d2f05283d2226f3285dccfc373ee9e314a8c95c8Stéphane Marchesin#include "i915_fpc.h"
37c990d0fd57a05301429b3af75b7fed0337621941Brian#include "i915_reg.h"
38846b7fbc6c9cbd57eed01bd04b1da73109935091Brian
3934a774797c17855043c8e1f701ada7f7aca39701Brian Paulstatic uint find_mapping(const struct i915_fragment_shader* fs, int unit)
40abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin{
41abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   int i;
42abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   for (i = 0; i < I915_TEX_UNITS ; i++)
43abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   {
44abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin      if (fs->generic_mapping[i] == unit)
45abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin         return i;
46abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   }
47abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   debug_printf("Mapping not found\n");
48abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   return 0;
49abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin}
50abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin
514ed87bf2291e4873e94cefe44ddf2b590b09cc42Brian
524ed87bf2291e4873e94cefe44ddf2b590b09cc42Brian
53e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz/***********************************************************************
54846b7fbc6c9cbd57eed01bd04b1da73109935091Brian * Determine the hardware vertex layout.
55846b7fbc6c9cbd57eed01bd04b1da73109935091Brian * Depends on vertex/fragment shader state.
5601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell */
57e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantzstatic void calculate_vertex_layout(struct i915_context *i915)
5801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell{
594901410293b35ac6bb4759142b50fcc0be8a1b25Brian   const struct i915_fragment_shader *fs = i915->fs;
60a70c5e37f1c2e43738469e4799ad2b9e7c604782Zack Rusin   const enum interp_mode colorInterp = i915->rasterizer->color_interp;
61f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian   struct vertex_info vinfo;
62ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin   boolean texCoords[I915_TEX_UNITS], colors[2], fog, needW, face;
6337cf13ed9a429c755f121daa1776b1b30a985ab3Brian   uint i;
64846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   int src;
6501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
6637cf13ed9a429c755f121daa1776b1b30a985ab3Brian   memset(texCoords, 0, sizeof(texCoords));
67ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin   colors[0] = colors[1] = fog = needW = face = FALSE;
68f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian   memset(&vinfo, 0, sizeof(vinfo));
6901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
70846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* Determine which fragment program inputs are needed.  Setup HW vertex
71846b7fbc6c9cbd57eed01bd04b1da73109935091Brian    * layout below, in the HW-specific attribute order.
72846b7fbc6c9cbd57eed01bd04b1da73109935091Brian    */
734901410293b35ac6bb4759142b50fcc0be8a1b25Brian   for (i = 0; i < fs->info.num_inputs; i++) {
744901410293b35ac6bb4759142b50fcc0be8a1b25Brian      switch (fs->info.input_semantic_name[i]) {
7537cf13ed9a429c755f121daa1776b1b30a985ab3Brian      case TGSI_SEMANTIC_POSITION:
76d2f05283d2226f3285dccfc373ee9e314a8c95c8Stéphane Marchesin         {
77d2f05283d2226f3285dccfc373ee9e314a8c95c8Stéphane Marchesin            uint unit = I915_SEMANTIC_POS;
78d2f05283d2226f3285dccfc373ee9e314a8c95c8Stéphane Marchesin            texCoords[find_mapping(fs, unit)] = TRUE;
79d2f05283d2226f3285dccfc373ee9e314a8c95c8Stéphane Marchesin         }
8037cf13ed9a429c755f121daa1776b1b30a985ab3Brian         break;
81f69b5c56feb60791bad27d491ee9592238d4efb0Brian      case TGSI_SEMANTIC_COLOR:
824901410293b35ac6bb4759142b50fcc0be8a1b25Brian         assert(fs->info.input_semantic_index[i] < 2);
834901410293b35ac6bb4759142b50fcc0be8a1b25Brian         colors[fs->info.input_semantic_index[i]] = TRUE;
8437cf13ed9a429c755f121daa1776b1b30a985ab3Brian         break;
85e9259ad0d7f674a1f2f9156ba0baeedc0e7d0d54Brian      case TGSI_SEMANTIC_GENERIC:
8637cf13ed9a429c755f121daa1776b1b30a985ab3Brian         {
87abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin            /* texcoords/varyings/other generic */
880ce977a66e65ce862f5b29ded6098de91464f304Stéphane Marchesin            uint unit = fs->info.input_semantic_index[i];
890ce977a66e65ce862f5b29ded6098de91464f304Stéphane Marchesin
90abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin            texCoords[find_mapping(fs, unit)] = TRUE;
9137cf13ed9a429c755f121daa1776b1b30a985ab3Brian            needW = TRUE;
9237cf13ed9a429c755f121daa1776b1b30a985ab3Brian         }
9337cf13ed9a429c755f121daa1776b1b30a985ab3Brian         break;
94726060680ba69aaec659f78e24f2db58acd780cbBrian      case TGSI_SEMANTIC_FOG:
95846b7fbc6c9cbd57eed01bd04b1da73109935091Brian         fog = TRUE;
96726060680ba69aaec659f78e24f2db58acd780cbBrian         break;
97ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin      case TGSI_SEMANTIC_FACE:
98ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin         face = TRUE;
99ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin         break;
10037cf13ed9a429c755f121daa1776b1b30a985ab3Brian      default:
101ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin         debug_printf("Unknown input type %d\n", fs->info.input_semantic_name[i]);
10237cf13ed9a429c755f121daa1776b1b30a985ab3Brian         assert(0);
10337cf13ed9a429c755f121daa1776b1b30a985ab3Brian      }
10437cf13ed9a429c755f121daa1776b1b30a985ab3Brian   }
10537cf13ed9a429c755f121daa1776b1b30a985ab3Brian
1060ce977a66e65ce862f5b29ded6098de91464f304Stéphane Marchesin
107846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* pos */
10889d8577fb3036547ef0b47498cc8dc5c77f886e0Zack Rusin   src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_POSITION, 0);
1096998402016e146d6afe06549ce2fb5941d6b03c7Brian   if (needW) {
110846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src);
111f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian      vinfo.hwfmt[0] |= S4_VFMT_XYZW;
11253d4706c6c0922160f310834daaec5718ff1c511Keith Whitwell      vinfo.attrib[0].emit = EMIT_4F;
1136998402016e146d6afe06549ce2fb5941d6b03c7Brian   }
1146998402016e146d6afe06549ce2fb5941d6b03c7Brian   else {
115846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      draw_emit_vertex_attr(&vinfo, EMIT_3F, INTERP_LINEAR, src);
116f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian      vinfo.hwfmt[0] |= S4_VFMT_XYZ;
11753d4706c6c0922160f310834daaec5718ff1c511Keith Whitwell      vinfo.attrib[0].emit = EMIT_3F;
1186998402016e146d6afe06549ce2fb5941d6b03c7Brian   }
1196998402016e146d6afe06549ce2fb5941d6b03c7Brian
120846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* hardware point size */
121846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* XXX todo */
122846b7fbc6c9cbd57eed01bd04b1da73109935091Brian
123846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* primary color */
124846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   if (colors[0]) {
12589d8577fb3036547ef0b47498cc8dc5c77f886e0Zack Rusin      src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 0);
126fe306e7ea5e789adc955653d9be8cd7f8af47264Jakob Bornecrantz      draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, colorInterp, src);
127846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      vinfo.hwfmt[0] |= S4_VFMT_COLOR;
128846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   }
129846b7fbc6c9cbd57eed01bd04b1da73109935091Brian
130846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* secondary color */
131846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   if (colors[1]) {
13289d8577fb3036547ef0b47498cc8dc5c77f886e0Zack Rusin      src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 1);
133fe306e7ea5e789adc955653d9be8cd7f8af47264Jakob Bornecrantz      draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, colorInterp, src);
134846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG;
135846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   }
136846b7fbc6c9cbd57eed01bd04b1da73109935091Brian
137846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   /* fog coord, not fog blend factor */
138846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   if (fog) {
13989d8577fb3036547ef0b47498cc8dc5c77f886e0Zack Rusin      src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FOG, 0);
140846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src);
141846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      vinfo.hwfmt[0] |= S4_VFMT_FOG_PARAM;
142846b7fbc6c9cbd57eed01bd04b1da73109935091Brian   }
143846b7fbc6c9cbd57eed01bd04b1da73109935091Brian
1440ce977a66e65ce862f5b29ded6098de91464f304Stéphane Marchesin   /* texcoords/varyings */
145abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin   for (i = 0; i < I915_TEX_UNITS; i++) {
146846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      uint hwtc;
147846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      if (texCoords[i]) {
148846b7fbc6c9cbd57eed01bd04b1da73109935091Brian         hwtc = TEXCOORDFMT_4D;
149abb436526974bd090853c0927ece0839f9143393Stéphane Marchesin         src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_GENERIC, fs->generic_mapping[i]);
150846b7fbc6c9cbd57eed01bd04b1da73109935091Brian         draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
151cc2629f5912d1c608f830ab63f6c4e0875d2fcefZack Rusin      }
152846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      else {
153846b7fbc6c9cbd57eed01bd04b1da73109935091Brian         hwtc = TEXCOORDFMT_NOT_PRESENT;
15401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      }
155846b7fbc6c9cbd57eed01bd04b1da73109935091Brian      vinfo.hwfmt[1] |= hwtc << (i * 4);
15601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   }
15701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
158ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin   /* front/back face */
159ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin   if (face) {
1608dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin      uint slot = find_mapping(fs, I915_SEMANTIC_FACE);
161ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin      debug_printf("Front/back face is broken\n");
1628dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin      /* XXX Because of limitations in the draw module, currently src will be 0
1638dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin       * for SEMANTIC_FACE, so this aliases to POS. We need to fix in the draw
1648dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin       * module by adding an extra shader output.
1658dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin       */
166ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin      src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FACE, 0);
167ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin      draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_CONSTANT, src);
1688dd1e3670ff4d12479475329961693e597b7a3cfStéphane Marchesin      vinfo.hwfmt[1] &= ~(TEXCOORDFMT_NOT_PRESENT << (slot * 4));
169ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin      vinfo.hwfmt[1] |= TEXCOORDFMT_1D << (slot * 4);
170ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin   }
171ef3dac2aff5fda16d7b7662c2c8828f07c9842aeStéphane Marchesin
172f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian   draw_compute_vertex_size(&vinfo);
173f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian
174f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian   if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) {
175f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian      /* Need to set this flag so that the LIS2/4 registers get set.
176f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian       * It also means the i915_update_immediate() function must be called
177f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian       * after this one, in i915_update_derived().
178f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian       */
179f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian      i915->dirty |= I915_NEW_VERTEX_FORMAT;
180f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian
181f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian      memcpy(&i915->current.vertex_info, &vinfo, sizeof(vinfo));
182f8b2148a2b0c28ea5970be275f1bd678aa32094dBrian   }
18301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell}
18401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
185e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantzstruct i915_tracked_state i915_update_vertex_layout = {
186e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   "vertex_layout",
187e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   calculate_vertex_layout,
188e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   I915_NEW_RASTERIZER | I915_NEW_FS | I915_NEW_VS
189e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz};
19001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
19101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
192c990d0fd57a05301429b3af75b7fed0337621941Brian
193e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz/***********************************************************************
194e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz */
195e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantzstatic struct i915_tracked_state *atoms[] = {
196e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_update_vertex_layout,
197e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_samplers,
198e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_sampler_views,
199e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_immediate,
200e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_dynamic,
201e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_fs,
202e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   &i915_hw_framebuffer,
20311ee41fe7f72f7136b531f0c51f820e90a610a79Daniel Vetter   &i915_hw_dst_buf_vars,
2048b122bdf6c0ba3bd77ff6f5b85b7fa84865535dbJakob Bornecrantz   &i915_hw_constants,
205e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   NULL,
206e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz};
207e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz
208e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantzvoid i915_update_derived(struct i915_context *i915)
209e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz{
210e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   int i;
211e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz
212abbb1bde06990cb15c82ebcdb9ac07b00cb0ab4fJakob Bornecrantz   if (I915_DBG_ON(DBG_ATOMS))
213abbb1bde06990cb15c82ebcdb9ac07b00cb0ab4fJakob Bornecrantz      i915_dump_dirty(i915, __FUNCTION__);
214abbb1bde06990cb15c82ebcdb9ac07b00cb0ab4fJakob Bornecrantz
215e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz   for (i = 0; atoms[i]; i++)
216e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz      if (atoms[i]->dirty & i915->dirty)
217e694f3fd4865f7e85cf1d4c9fe5789fad399dbc6Jakob Bornecrantz         atoms[i]->update(i915);
218277e4989f348913e3852f3d8c4efb82ba1380fcbKeith Whitwell
21901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   i915->dirty = 0;
22001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell}
221