1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2015 Intel Corporation
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#include "isl_priv.h"
25bf215546Sopenharmony_ci#include "compiler/brw_compiler.h"
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_cibool
28bf215546Sopenharmony_ciisl_is_storage_image_format(enum isl_format format)
29bf215546Sopenharmony_ci{
30bf215546Sopenharmony_ci   /* XXX: Maybe we should put this in the CSV? */
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci   switch (format) {
33bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_UINT:
34bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_SINT:
35bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_FLOAT:
36bf215546Sopenharmony_ci   case ISL_FORMAT_R32_UINT:
37bf215546Sopenharmony_ci   case ISL_FORMAT_R32_SINT:
38bf215546Sopenharmony_ci   case ISL_FORMAT_R32_FLOAT:
39bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_UINT:
40bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_SINT:
41bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_FLOAT:
42bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_UINT:
43bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_SINT:
44bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_FLOAT:
45bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_UINT:
46bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_SINT:
47bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_UINT:
48bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_SINT:
49bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_FLOAT:
50bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_UINT:
51bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_SINT:
52bf215546Sopenharmony_ci   case ISL_FORMAT_R16_UINT:
53bf215546Sopenharmony_ci   case ISL_FORMAT_R16_FLOAT:
54bf215546Sopenharmony_ci   case ISL_FORMAT_R16_SINT:
55bf215546Sopenharmony_ci   case ISL_FORMAT_R8_UINT:
56bf215546Sopenharmony_ci   case ISL_FORMAT_R8_SINT:
57bf215546Sopenharmony_ci   case ISL_FORMAT_R10G10B10A2_UINT:
58bf215546Sopenharmony_ci   case ISL_FORMAT_R10G10B10A2_UNORM:
59bf215546Sopenharmony_ci   case ISL_FORMAT_R11G11B10_FLOAT:
60bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_UNORM:
61bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_SNORM:
62bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_UNORM:
63bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_SNORM:
64bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_UNORM:
65bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_SNORM:
66bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_UNORM:
67bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_SNORM:
68bf215546Sopenharmony_ci   case ISL_FORMAT_R16_UNORM:
69bf215546Sopenharmony_ci   case ISL_FORMAT_R16_SNORM:
70bf215546Sopenharmony_ci   case ISL_FORMAT_R8_UNORM:
71bf215546Sopenharmony_ci   case ISL_FORMAT_R8_SNORM:
72bf215546Sopenharmony_ci      return true;
73bf215546Sopenharmony_ci   default:
74bf215546Sopenharmony_ci      return false;
75bf215546Sopenharmony_ci   }
76bf215546Sopenharmony_ci}
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_cienum isl_format
79bf215546Sopenharmony_ciisl_lower_storage_image_format(const struct intel_device_info *devinfo,
80bf215546Sopenharmony_ci                               enum isl_format format)
81bf215546Sopenharmony_ci{
82bf215546Sopenharmony_ci   switch (format) {
83bf215546Sopenharmony_ci   /* These are never lowered.  Up to BDW we'll have to fall back to untyped
84bf215546Sopenharmony_ci    * surface access for 128bpp formats.
85bf215546Sopenharmony_ci    */
86bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_UINT:
87bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_SINT:
88bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32B32A32_FLOAT:
89bf215546Sopenharmony_ci   case ISL_FORMAT_R32_UINT:
90bf215546Sopenharmony_ci   case ISL_FORMAT_R32_SINT:
91bf215546Sopenharmony_ci      return format;
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ci   /* The Skylake PRM's "Surface Formats" section says:
94bf215546Sopenharmony_ci    *
95bf215546Sopenharmony_ci    *   "The surface format for the typed atomic integer operations must
96bf215546Sopenharmony_ci    *    be R32_UINT or R32_SINT."
97bf215546Sopenharmony_ci    */
98bf215546Sopenharmony_ci   case ISL_FORMAT_R32_FLOAT:
99bf215546Sopenharmony_ci      return ISL_FORMAT_R32_UINT;
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci   /* From HSW to BDW the only 64bpp format supported for typed access is
102bf215546Sopenharmony_ci    * RGBA_UINT16.  IVB falls back to untyped.
103bf215546Sopenharmony_ci    */
104bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_UINT:
105bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_SINT:
106bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_FLOAT:
107bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_UINT:
108bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_SINT:
109bf215546Sopenharmony_ci   case ISL_FORMAT_R32G32_FLOAT:
110bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format :
111bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
112bf215546Sopenharmony_ci              ISL_FORMAT_R16G16B16A16_UINT :
113bf215546Sopenharmony_ci              ISL_FORMAT_R32G32_UINT);
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ci   /* Up to BDW no SINT or FLOAT formats of less than 32 bits per component
116bf215546Sopenharmony_ci    * are supported.  IVB doesn't support formats with more than one component
117bf215546Sopenharmony_ci    * for typed access.  For 8 and 16 bpp formats IVB relies on the
118bf215546Sopenharmony_ci    * undocumented behavior that typed reads from R_UINT8 and R_UINT16
119bf215546Sopenharmony_ci    * surfaces actually do a 32-bit misaligned read.  The alternative would be
120bf215546Sopenharmony_ci    * to use two surface state entries with different formats for each image,
121bf215546Sopenharmony_ci    * one for reading (using R_UINT32) and another one for writing (using
122bf215546Sopenharmony_ci    * R_UINT8 or R_UINT16), but that would complicate the shaders we generate
123bf215546Sopenharmony_ci    * even more.
124bf215546Sopenharmony_ci    */
125bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_UINT:
126bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_SINT:
127bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format :
128bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
129bf215546Sopenharmony_ci              ISL_FORMAT_R8G8B8A8_UINT : ISL_FORMAT_R32_UINT);
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_UINT:
132bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_SINT:
133bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_FLOAT:
134bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format :
135bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
136bf215546Sopenharmony_ci              ISL_FORMAT_R16G16_UINT : ISL_FORMAT_R32_UINT);
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_UINT:
139bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_SINT:
140bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format :
141bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
142bf215546Sopenharmony_ci              ISL_FORMAT_R8G8_UINT : ISL_FORMAT_R16_UINT);
143bf215546Sopenharmony_ci
144bf215546Sopenharmony_ci   case ISL_FORMAT_R16_UINT:
145bf215546Sopenharmony_ci   case ISL_FORMAT_R16_FLOAT:
146bf215546Sopenharmony_ci   case ISL_FORMAT_R16_SINT:
147bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format : ISL_FORMAT_R16_UINT);
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci   case ISL_FORMAT_R8_UINT:
150bf215546Sopenharmony_ci   case ISL_FORMAT_R8_SINT:
151bf215546Sopenharmony_ci      return (devinfo->ver >= 9 ? format : ISL_FORMAT_R8_UINT);
152bf215546Sopenharmony_ci
153bf215546Sopenharmony_ci   /* Neither the 2/10/10/10 nor the 11/11/10 packed formats are supported
154bf215546Sopenharmony_ci    * by the hardware.
155bf215546Sopenharmony_ci    */
156bf215546Sopenharmony_ci   case ISL_FORMAT_R10G10B10A2_UINT:
157bf215546Sopenharmony_ci   case ISL_FORMAT_R10G10B10A2_UNORM:
158bf215546Sopenharmony_ci   case ISL_FORMAT_R11G11B10_FLOAT:
159bf215546Sopenharmony_ci      return ISL_FORMAT_R32_UINT;
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_ci   /* No normalized fixed-point formats are supported by the hardware. */
162bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_UNORM:
163bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16B16A16_SNORM:
164bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format :
165bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
166bf215546Sopenharmony_ci              ISL_FORMAT_R16G16B16A16_UINT :
167bf215546Sopenharmony_ci              ISL_FORMAT_R32G32_UINT);
168bf215546Sopenharmony_ci
169bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_UNORM:
170bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8B8A8_SNORM:
171bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format :
172bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
173bf215546Sopenharmony_ci              ISL_FORMAT_R8G8B8A8_UINT : ISL_FORMAT_R32_UINT);
174bf215546Sopenharmony_ci
175bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_UNORM:
176bf215546Sopenharmony_ci   case ISL_FORMAT_R16G16_SNORM:
177bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format :
178bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
179bf215546Sopenharmony_ci              ISL_FORMAT_R16G16_UINT : ISL_FORMAT_R32_UINT);
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_UNORM:
182bf215546Sopenharmony_ci   case ISL_FORMAT_R8G8_SNORM:
183bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format :
184bf215546Sopenharmony_ci              devinfo->verx10 >= 75 ?
185bf215546Sopenharmony_ci              ISL_FORMAT_R8G8_UINT : ISL_FORMAT_R16_UINT);
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci   case ISL_FORMAT_R16_UNORM:
188bf215546Sopenharmony_ci   case ISL_FORMAT_R16_SNORM:
189bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format : ISL_FORMAT_R16_UINT);
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ci   case ISL_FORMAT_R8_UNORM:
192bf215546Sopenharmony_ci   case ISL_FORMAT_R8_SNORM:
193bf215546Sopenharmony_ci      return (devinfo->ver >= 11 ? format : ISL_FORMAT_R8_UINT);
194bf215546Sopenharmony_ci
195bf215546Sopenharmony_ci   default:
196bf215546Sopenharmony_ci      assert(!"Unknown image format");
197bf215546Sopenharmony_ci      return ISL_FORMAT_UNSUPPORTED;
198bf215546Sopenharmony_ci   }
199bf215546Sopenharmony_ci}
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_cibool
202bf215546Sopenharmony_ciisl_has_matching_typed_storage_image_format(const struct intel_device_info *devinfo,
203bf215546Sopenharmony_ci                                            enum isl_format fmt)
204bf215546Sopenharmony_ci{
205bf215546Sopenharmony_ci   if (devinfo->ver >= 9) {
206bf215546Sopenharmony_ci      return true;
207bf215546Sopenharmony_ci   } else if (devinfo->verx10 >= 75) {
208bf215546Sopenharmony_ci      return isl_format_get_layout(fmt)->bpb <= 64;
209bf215546Sopenharmony_ci   } else {
210bf215546Sopenharmony_ci      return isl_format_get_layout(fmt)->bpb <= 32;
211bf215546Sopenharmony_ci   }
212bf215546Sopenharmony_ci}
213bf215546Sopenharmony_ci
214bf215546Sopenharmony_cistatic const struct brw_image_param image_param_defaults = {
215bf215546Sopenharmony_ci   /* Set the swizzling shifts to all-ones to effectively disable
216bf215546Sopenharmony_ci    * swizzling -- See emit_address_calculation() in
217bf215546Sopenharmony_ci    * brw_fs_surface_builder.cpp for a more detailed explanation of
218bf215546Sopenharmony_ci    * these parameters.
219bf215546Sopenharmony_ci    */
220bf215546Sopenharmony_ci   .swizzling = { 0xff, 0xff },
221bf215546Sopenharmony_ci};
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_civoid
224bf215546Sopenharmony_ciisl_surf_fill_image_param(const struct isl_device *dev,
225bf215546Sopenharmony_ci                          struct brw_image_param *param,
226bf215546Sopenharmony_ci                          const struct isl_surf *surf,
227bf215546Sopenharmony_ci                          const struct isl_view *view)
228bf215546Sopenharmony_ci{
229bf215546Sopenharmony_ci   *param = image_param_defaults;
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_ci   if (surf->dim != ISL_SURF_DIM_3D) {
232bf215546Sopenharmony_ci      assert(view->base_array_layer + view->array_len <=
233bf215546Sopenharmony_ci             surf->logical_level0_px.array_len);
234bf215546Sopenharmony_ci   }
235bf215546Sopenharmony_ci   param->size[0] = isl_minify(surf->logical_level0_px.w, view->base_level);
236bf215546Sopenharmony_ci   param->size[1] = surf->dim == ISL_SURF_DIM_1D ?
237bf215546Sopenharmony_ci                    view->array_len :
238bf215546Sopenharmony_ci                    isl_minify(surf->logical_level0_px.h, view->base_level);
239bf215546Sopenharmony_ci   param->size[2] = surf->dim == ISL_SURF_DIM_2D ?
240bf215546Sopenharmony_ci                    view->array_len :
241bf215546Sopenharmony_ci                    isl_minify(surf->logical_level0_px.d, view->base_level);
242bf215546Sopenharmony_ci
243bf215546Sopenharmony_ci   uint32_t tile_z_el, phys_array_layer;
244bf215546Sopenharmony_ci   isl_surf_get_image_offset_el(surf, view->base_level,
245bf215546Sopenharmony_ci                                surf->dim == ISL_SURF_DIM_3D ?
246bf215546Sopenharmony_ci                                   0 : view->base_array_layer,
247bf215546Sopenharmony_ci                                surf->dim == ISL_SURF_DIM_3D ?
248bf215546Sopenharmony_ci                                   view->base_array_layer : 0,
249bf215546Sopenharmony_ci                                &param->offset[0],  &param->offset[1],
250bf215546Sopenharmony_ci                                &tile_z_el, &phys_array_layer);
251bf215546Sopenharmony_ci   assert(tile_z_el == 0);
252bf215546Sopenharmony_ci   assert(phys_array_layer == 0);
253bf215546Sopenharmony_ci
254bf215546Sopenharmony_ci   const int cpp = isl_format_get_layout(surf->format)->bpb / 8;
255bf215546Sopenharmony_ci   param->stride[0] = cpp;
256bf215546Sopenharmony_ci   param->stride[1] = surf->row_pitch_B / cpp;
257bf215546Sopenharmony_ci
258bf215546Sopenharmony_ci   const struct isl_extent3d image_align_sa =
259bf215546Sopenharmony_ci      isl_surf_get_image_alignment_sa(surf);
260bf215546Sopenharmony_ci   if (ISL_GFX_VER(dev) < 9 && surf->dim == ISL_SURF_DIM_3D) {
261bf215546Sopenharmony_ci      param->stride[2] = isl_align_npot(param->size[0], image_align_sa.w);
262bf215546Sopenharmony_ci      param->stride[3] = isl_align_npot(param->size[1], image_align_sa.h);
263bf215546Sopenharmony_ci   } else {
264bf215546Sopenharmony_ci      param->stride[2] = 0;
265bf215546Sopenharmony_ci      param->stride[3] = isl_surf_get_array_pitch_el_rows(surf);
266bf215546Sopenharmony_ci   }
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci   switch (surf->tiling) {
269bf215546Sopenharmony_ci   case ISL_TILING_LINEAR:
270bf215546Sopenharmony_ci      /* image_param_defaults is good enough */
271bf215546Sopenharmony_ci      break;
272bf215546Sopenharmony_ci
273bf215546Sopenharmony_ci   case ISL_TILING_X:
274bf215546Sopenharmony_ci      /* An X tile is a rectangular block of 512x8 bytes. */
275bf215546Sopenharmony_ci      param->tiling[0] = isl_log2u(512 / cpp);
276bf215546Sopenharmony_ci      param->tiling[1] = isl_log2u(8);
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ci      if (dev->has_bit6_swizzling) {
279bf215546Sopenharmony_ci         /* Right shifts required to swizzle bits 9 and 10 of the memory
280bf215546Sopenharmony_ci          * address with bit 6.
281bf215546Sopenharmony_ci          */
282bf215546Sopenharmony_ci         param->swizzling[0] = 3;
283bf215546Sopenharmony_ci         param->swizzling[1] = 4;
284bf215546Sopenharmony_ci      }
285bf215546Sopenharmony_ci      break;
286bf215546Sopenharmony_ci
287bf215546Sopenharmony_ci   case ISL_TILING_Y0:
288bf215546Sopenharmony_ci      /* The layout of a Y-tiled surface in memory isn't really fundamentally
289bf215546Sopenharmony_ci       * different to the layout of an X-tiled surface, we simply pretend that
290bf215546Sopenharmony_ci       * the surface is broken up in a number of smaller 16Bx32 tiles, each
291bf215546Sopenharmony_ci       * one arranged in X-major order just like is the case for X-tiling.
292bf215546Sopenharmony_ci       */
293bf215546Sopenharmony_ci      param->tiling[0] = isl_log2u(16 / cpp);
294bf215546Sopenharmony_ci      param->tiling[1] = isl_log2u(32);
295bf215546Sopenharmony_ci
296bf215546Sopenharmony_ci      if (dev->has_bit6_swizzling) {
297bf215546Sopenharmony_ci         /* Right shift required to swizzle bit 9 of the memory address with
298bf215546Sopenharmony_ci          * bit 6.
299bf215546Sopenharmony_ci          */
300bf215546Sopenharmony_ci         param->swizzling[0] = 3;
301bf215546Sopenharmony_ci         param->swizzling[1] = 0xff;
302bf215546Sopenharmony_ci      }
303bf215546Sopenharmony_ci      break;
304bf215546Sopenharmony_ci
305bf215546Sopenharmony_ci   default:
306bf215546Sopenharmony_ci      assert(!"Unhandled storage image tiling");
307bf215546Sopenharmony_ci   }
308bf215546Sopenharmony_ci
309bf215546Sopenharmony_ci   /* 3D textures are arranged in 2D in memory with 2^lod slices per row.  The
310bf215546Sopenharmony_ci    * address calculation algorithm (emit_address_calculation() in
311bf215546Sopenharmony_ci    * brw_fs_surface_builder.cpp) handles this as a sort of tiling with
312bf215546Sopenharmony_ci    * modulus equal to the LOD.
313bf215546Sopenharmony_ci    */
314bf215546Sopenharmony_ci   param->tiling[2] = (ISL_GFX_VER(dev) < 9 && surf->dim == ISL_SURF_DIM_3D ?
315bf215546Sopenharmony_ci                       view->base_level : 0);
316bf215546Sopenharmony_ci}
317bf215546Sopenharmony_ci
318bf215546Sopenharmony_civoid
319bf215546Sopenharmony_ciisl_buffer_fill_image_param(const struct isl_device *dev,
320bf215546Sopenharmony_ci                            struct brw_image_param *param,
321bf215546Sopenharmony_ci                            enum isl_format format,
322bf215546Sopenharmony_ci                            uint64_t size)
323bf215546Sopenharmony_ci{
324bf215546Sopenharmony_ci   *param = image_param_defaults;
325bf215546Sopenharmony_ci
326bf215546Sopenharmony_ci   param->stride[0] = isl_format_get_layout(format)->bpb / 8;
327bf215546Sopenharmony_ci   param->size[0] = size / param->stride[0];
328bf215546Sopenharmony_ci}
329