2 * Copyright (c) 2018 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #include "isl_gen12.h"
29 isl_gen12_choose_image_alignment_el(const struct isl_device
*dev
,
30 const struct isl_surf_init_info
*restrict info
,
31 enum isl_tiling tiling
,
32 enum isl_dim_layout dim_layout
,
33 enum isl_msaa_layout msaa_layout
,
34 struct isl_extent3d
*image_align_el
)
36 /* Handled by isl_choose_image_alignment_el */
37 assert(info
->format
!= ISL_FORMAT_HIZ
);
39 if (isl_surf_usage_is_depth(info
->usage
)) {
40 /* The alignment parameters for depth buffers are summarized in the
43 * Surface Format | MSAA | Align Width | Align Height
44 * -----------------+-------------+-------------+--------------
45 * D16_UNORM | 1x, 4x, 16x | 8 | 8
46 * ----------------+-------------+-------------+--------------
47 * D16_UNORM | 2x, 8x | 16 | 4
48 * ----------------+-------------+-------------+--------------
50 * -----------------+-------------+-------------+--------------
52 assert(isl_is_pow2(info
->samples
));
54 info
->format
!= ISL_FORMAT_R16_UNORM
?
55 isl_extent3d(8, 4, 1) :
56 (info
->samples
== 2 || info
->samples
== 8 ?
57 isl_extent3d(16, 4, 1) : isl_extent3d(8, 8, 1));
58 } else if (isl_surf_usage_is_stencil(info
->usage
)) {
59 *image_align_el
= isl_extent3d(16, 8, 1);
61 isl_gen9_choose_image_alignment_el(dev
, info
, tiling
, dim_layout
,
62 msaa_layout
, image_align_el
);