/*1* Copyright (c) 2018 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include "isl_gfx9.h"24#include "isl_gfx12.h"25#include "isl_priv.h"2627void28isl_gfx12_choose_image_alignment_el(const struct isl_device *dev,29const struct isl_surf_init_info *restrict info,30enum isl_tiling tiling,31enum isl_dim_layout dim_layout,32enum isl_msaa_layout msaa_layout,33struct isl_extent3d *image_align_el)34{35/* Handled by isl_choose_image_alignment_el */36assert(info->format != ISL_FORMAT_HIZ);3738const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);39if (fmtl->txc == ISL_TXC_CCS) {40/* This CCS compresses a 2D-view of the entire surface. */41assert(info->levels == 1 && info->array_len == 1 && info->depth == 1);42*image_align_el = isl_extent3d(1, 1, 1);43return;44}4546if (isl_surf_usage_is_depth(info->usage)) {47/* The alignment parameters for depth buffers are summarized in the48* following table:49*50* Surface Format | MSAA | Align Width | Align Height51* -----------------+-------------+-------------+--------------52* D16_UNORM | 1x, 4x, 16x | 8 | 853* ----------------+-------------+-------------+--------------54* D16_UNORM | 2x, 8x | 16 | 455* ----------------+-------------+-------------+--------------56* other | any | 8 | 457* -----------------+-------------+-------------+--------------58*/59assert(isl_is_pow2(info->samples));60*image_align_el =61info->format != ISL_FORMAT_R16_UNORM ?62isl_extent3d(8, 4, 1) :63(info->samples == 2 || info->samples == 8 ?64isl_extent3d(16, 4, 1) : isl_extent3d(8, 8, 1));65} else if (isl_surf_usage_is_stencil(info->usage)) {66*image_align_el = isl_extent3d(16, 8, 1);67} else {68isl_gfx9_choose_image_alignment_el(dev, info, tiling, dim_layout,69msaa_layout, image_align_el);70}71}727374