@@ -69,8 +69,8 @@ uint32_t pte_mocs[] = {
6969 [10 ] = CNL_MOCS_PTE ,
7070};
7171
72- static uint32_t
73- get_tex_mocs (const struct gen_device_info * devinfo , struct brw_bo * bo )
72+ uint32_t
73+ brw_get_bo_mocs (const struct gen_device_info * devinfo , struct brw_bo * bo )
7474{
7575 return (bo && bo -> external ? pte_mocs : wb_mocs )[devinfo -> gen ];
7676}
@@ -134,9 +134,10 @@ brw_emit_surface_state(struct brw_context *brw,
134134 struct intel_mipmap_tree * mt ,
135135 GLenum target , struct isl_view view ,
136136 enum isl_aux_usage aux_usage ,
137- uint32_t mocs , uint32_t * surf_offset , int surf_index ,
137+ uint32_t * surf_offset , int surf_index ,
138138 unsigned reloc_flags )
139139{
140+ const struct gen_device_info * devinfo = & brw -> screen -> devinfo ;
140141 uint32_t tile_x = mt -> level [0 ].level_x ;
141142 uint32_t tile_y = mt -> level [0 ].level_y ;
142143 uint32_t offset = mt -> offset ;
@@ -187,7 +188,8 @@ brw_emit_surface_state(struct brw_context *brw,
187188 mt -> bo , offset , reloc_flags ),
188189 .aux_surf = aux_surf , .aux_usage = aux_usage ,
189190 .aux_address = aux_offset ,
190- .mocs = mocs , .clear_color = clear_color ,
191+ .mocs = brw_get_bo_mocs (devinfo , mt -> bo ),
192+ .clear_color = clear_color ,
191193 .x_offset_sa = tile_x , .y_offset_sa = tile_y );
192194 if (aux_surf ) {
193195 /* On gen7 and prior, the upper 20 bits of surface state DWORD 6 are the
@@ -214,7 +216,6 @@ gen6_update_renderbuffer_surface(struct brw_context *brw,
214216 unsigned unit ,
215217 uint32_t surf_index )
216218{
217- const struct gen_device_info * devinfo = & brw -> screen -> devinfo ;
218219 struct gl_context * ctx = & brw -> ctx ;
219220 struct intel_renderbuffer * irb = intel_renderbuffer (rb );
220221 struct intel_mipmap_tree * mt = irb -> mt ;
@@ -245,7 +246,6 @@ gen6_update_renderbuffer_surface(struct brw_context *brw,
245246
246247 uint32_t offset ;
247248 brw_emit_surface_state (brw , mt , mt -> target , view , aux_usage ,
248- pte_mocs [devinfo -> gen ],
249249 & offset , surf_index ,
250250 RELOC_WRITE );
251251 return offset ;
@@ -592,7 +592,6 @@ brw_update_texture_surface(struct gl_context *ctx,
592592 aux_usage = ISL_AUX_USAGE_NONE ;
593593
594594 brw_emit_surface_state (brw , mt , mt -> target , view , aux_usage ,
595- get_tex_mocs (devinfo , mt -> bo ),
596595 surf_offset , surf_index ,
597596 0 );
598597 }
@@ -623,7 +622,7 @@ brw_emit_buffer_surface_state(struct brw_context *brw,
623622 .size = buffer_size ,
624623 .format = surface_format ,
625624 .stride = pitch ,
626- .mocs = get_tex_mocs (devinfo , bo ));
625+ .mocs = brw_get_bo_mocs (devinfo , bo ));
627626}
628627
629628void
@@ -1057,7 +1056,6 @@ const struct brw_tracked_state gen6_renderbuffer_surfaces = {
10571056static void
10581057update_renderbuffer_read_surfaces (struct brw_context * brw )
10591058{
1060- const struct gen_device_info * devinfo = & brw -> screen -> devinfo ;
10611059 const struct gl_context * ctx = & brw -> ctx ;
10621060
10631061 /* BRW_NEW_FS_PROG_DATA */
@@ -1113,7 +1111,6 @@ update_renderbuffer_read_surfaces(struct brw_context *brw)
11131111 aux_usage = ISL_AUX_USAGE_NONE ;
11141112
11151113 brw_emit_surface_state (brw , irb -> mt , target , view , aux_usage ,
1116- get_tex_mocs (devinfo , irb -> mt -> bo ),
11171114 surf_offset , surf_index ,
11181115 0 );
11191116
@@ -1557,8 +1554,6 @@ update_image_surface(struct brw_context *brw,
15571554 uint32_t * surf_offset ,
15581555 struct brw_image_param * param )
15591556{
1560- const struct gen_device_info * devinfo = & brw -> screen -> devinfo ;
1561-
15621557 if (_mesa_is_image_unit_valid (& brw -> ctx , u )) {
15631558 struct gl_texture_object * obj = u -> TexObj ;
15641559 const unsigned format = get_image_format (brw , u -> _ActualFormat , access );
@@ -1606,7 +1601,6 @@ update_image_surface(struct brw_context *brw,
16061601 view .array_len ));
16071602 brw_emit_surface_state (brw , mt , mt -> target , view ,
16081603 ISL_AUX_USAGE_NONE ,
1609- get_tex_mocs (devinfo , mt -> bo ),
16101604 surf_offset , surf_index ,
16111605 access == GL_READ_ONLY ? 0 : RELOC_WRITE );
16121606 }
0 commit comments