2 * Copyright 2015 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
26 #include "mesa/main/imports.h"
31 * Log base 2, rounding towards zero.
33 static inline uint32_t
37 return 31 - __builtin_clz(n
);
41 isl_device_init(struct isl_device
*dev
, uint8_t gen10x
)
43 assert(gen10x
% 5 == 0);
48 * The returned extent's units are (width=bytes, height=rows).
51 isl_tiling_get_extent(const struct isl_device
*dev
,
52 enum isl_tiling tiling
,
54 struct isl_extent2d
*e
)
56 static const struct isl_extent2d legacy_extents
[] = {
57 [ISL_TILING_LINEAR
] = { 1, 1 },
58 [ISL_TILING_X
] = { 512, 8 },
59 [ISL_TILING_Y
] = { 128, 32 },
60 [ISL_TILING_W
] = { 128, 32 },
63 static const struct isl_extent2d yf_extents
[] = {
65 /* 1*/ [0] = { 64, 64 },
66 /* 2*/ [1] = { 128, 32 },
67 /* 4*/ [2] = { 128, 32 },
68 /* 8*/ [3] = { 256, 16 },
69 /*16*/ [4] = { 256, 16 },
75 case ISL_TILING_LINEAR
:
79 *e
= legacy_extents
[tiling
];
83 assert(_mesa_is_pow_two(cpp
));
84 *e
= yf_extents
[isl_log2u(cpp
)];
85 if (tiling
== ISL_TILING_Ys
) {