mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
intel/isl: Indent uncompressed surface code
We're about to add separate code for Yf/Ys and this helps keep the diff reasonable. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23620>
This commit is contained in:
parent
9a4e9848ad
commit
4ef7b074e7
1 changed files with 86 additions and 84 deletions
|
|
@ -3197,100 +3197,102 @@ isl_surf_get_uncompressed_surf(const struct isl_device *dev,
|
||||||
/* If we ever enable 3D block formats, we'll need to re-think this */
|
/* If we ever enable 3D block formats, we'll need to re-think this */
|
||||||
assert(fmtl->bd == 1);
|
assert(fmtl->bd == 1);
|
||||||
|
|
||||||
if (view->array_len > 1) {
|
{
|
||||||
/* The Skylake PRM Vol. 2d, "RENDER_SURFACE_STATE::X Offset" says:
|
if (view->array_len > 1) {
|
||||||
*
|
/* The Skylake PRM Vol. 2d, "RENDER_SURFACE_STATE::X Offset" says:
|
||||||
* "If Surface Array is enabled, this field must be zero."
|
*
|
||||||
*
|
* "If Surface Array is enabled, this field must be zero."
|
||||||
* The PRMs for other hardware have similar text. This is also tricky
|
*
|
||||||
* to handle with things like BLORP's SW offsetting because the
|
* The PRMs for other hardware have similar text. This is also tricky
|
||||||
* increased surface size required for the offset may result in an image
|
* to handle with things like BLORP's SW offsetting because the
|
||||||
* height greater than qpitch.
|
* increased surface size required for the offset may result in an
|
||||||
*/
|
* image height greater than qpitch.
|
||||||
if (view->base_level > 0)
|
*/
|
||||||
return false;
|
if (view->base_level > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* On Haswell and earlier, RENDER_SURFACE_STATE doesn't have a QPitch
|
/* On Haswell and earlier, RENDER_SURFACE_STATE doesn't have a QPitch
|
||||||
* field; it only has "array pitch span" which means the QPitch is
|
* field; it only has "array pitch span" which means the QPitch is
|
||||||
* automatically calculated. Since we're smashing the surface format
|
* automatically calculated. Since we're smashing the surface format
|
||||||
* (block formats are subtly different) and the number of miplevels,
|
* (block formats are subtly different) and the number of miplevels,
|
||||||
* that calculation will get thrown off. This means we can't do arrays
|
* that calculation will get thrown off. This means we can't do
|
||||||
* even at LOD0
|
* arrays even at LOD0
|
||||||
*
|
*
|
||||||
* On Broadwell, we do have a QPitch field which we can control.
|
* On Broadwell, we do have a QPitch field which we can control.
|
||||||
* However, HALIGN and VALIGN are specified in pixels and are
|
* However, HALIGN and VALIGN are specified in pixels and are
|
||||||
* hard-coded to align to exactly the block size of the compressed
|
* hard-coded to align to exactly the block size of the compressed
|
||||||
* texture. This means that, when reinterpreted as a non-compressed
|
* texture. This means that, when reinterpreted as a non-compressed
|
||||||
* the QPitch may be anything but the HW requires it to be properly
|
* the QPitch may be anything but the HW requires it to be properly
|
||||||
* aligned.
|
* aligned.
|
||||||
*/
|
*/
|
||||||
if (ISL_GFX_VER(dev) < 9)
|
if (ISL_GFX_VER(dev) < 9)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*ucompr_surf = *surf;
|
*ucompr_surf = *surf;
|
||||||
ucompr_surf->levels = 1;
|
ucompr_surf->levels = 1;
|
||||||
ucompr_surf->format = view_format;
|
ucompr_surf->format = view_format;
|
||||||
|
|
||||||
/* We're making an uncompressed view here. The image dimensions
|
/* We're making an uncompressed view here. The image dimensions need
|
||||||
* need to be scaled down by the block size.
|
* to be scaled down by the block size.
|
||||||
*/
|
*/
|
||||||
assert(ucompr_surf->logical_level0_px.width == view_width_px);
|
assert(ucompr_surf->logical_level0_px.width == view_width_px);
|
||||||
assert(ucompr_surf->logical_level0_px.height == view_height_px);
|
assert(ucompr_surf->logical_level0_px.height == view_height_px);
|
||||||
ucompr_surf->logical_level0_px.width = view_width_el;
|
ucompr_surf->logical_level0_px.width = view_width_el;
|
||||||
ucompr_surf->logical_level0_px.height = view_height_el;
|
ucompr_surf->logical_level0_px.height = view_height_el;
|
||||||
ucompr_surf->phys_level0_sa = isl_surf_get_phys_level0_el(surf);
|
ucompr_surf->phys_level0_sa = isl_surf_get_phys_level0_el(surf);
|
||||||
|
|
||||||
/* The surface mostly stays as-is; there is no offset */
|
/* The surface mostly stays as-is; there is no offset */
|
||||||
*offset_B = 0;
|
*offset_B = 0;
|
||||||
*x_offset_el = 0;
|
*x_offset_el = 0;
|
||||||
*y_offset_el = 0;
|
*y_offset_el = 0;
|
||||||
|
|
||||||
/* The view remains the same */
|
/* The view remains the same */
|
||||||
*ucompr_view = *view;
|
*ucompr_view = *view;
|
||||||
} else {
|
} else {
|
||||||
/* If only one array slice is requested, directly offset to that slice.
|
/* If only one array slice is requested, directly offset to that
|
||||||
* We could, in theory, still use arrays in some cases but BLORP isn't
|
* slice. We could, in theory, still use arrays in some cases but
|
||||||
* prepared for this and everyone who calls this function should be
|
* BLORP isn't prepared for this and everyone who calls this function
|
||||||
* prepared to handle an X/Y offset.
|
* should be prepared to handle an X/Y offset.
|
||||||
*/
|
*/
|
||||||
isl_surf_get_image_offset_B_tile_el(surf,
|
isl_surf_get_image_offset_B_tile_el(surf,
|
||||||
view->base_level,
|
view->base_level,
|
||||||
surf->dim == ISL_SURF_DIM_3D ?
|
surf->dim == ISL_SURF_DIM_3D ?
|
||||||
0 : view->base_array_layer,
|
0 : view->base_array_layer,
|
||||||
surf->dim == ISL_SURF_DIM_3D ?
|
surf->dim == ISL_SURF_DIM_3D ?
|
||||||
view->base_array_layer : 0,
|
view->base_array_layer : 0,
|
||||||
offset_B,
|
offset_B,
|
||||||
x_offset_el,
|
x_offset_el,
|
||||||
y_offset_el);
|
y_offset_el);
|
||||||
|
|
||||||
/* Even for cube maps there will be only single face, therefore drop the
|
/* Even for cube maps there will be only single face, therefore drop
|
||||||
* corresponding flag if present.
|
* the corresponding flag if present.
|
||||||
*/
|
*/
|
||||||
const isl_surf_usage_flags_t usage =
|
const isl_surf_usage_flags_t usage =
|
||||||
surf->usage & (~ISL_SURF_USAGE_CUBE_BIT);
|
surf->usage & (~ISL_SURF_USAGE_CUBE_BIT);
|
||||||
|
|
||||||
bool ok UNUSED;
|
bool ok UNUSED;
|
||||||
ok = isl_surf_init(dev, ucompr_surf,
|
ok = isl_surf_init(dev, ucompr_surf,
|
||||||
.dim = ISL_SURF_DIM_2D,
|
.dim = ISL_SURF_DIM_2D,
|
||||||
.format = view_format,
|
.format = view_format,
|
||||||
.width = view_width_el,
|
.width = view_width_el,
|
||||||
.height = view_height_el,
|
.height = view_height_el,
|
||||||
.depth = 1,
|
.depth = 1,
|
||||||
.levels = 1,
|
.levels = 1,
|
||||||
.array_len = 1,
|
.array_len = 1,
|
||||||
.samples = 1,
|
.samples = 1,
|
||||||
.row_pitch_B = surf->row_pitch_B,
|
.row_pitch_B = surf->row_pitch_B,
|
||||||
.usage = usage,
|
.usage = usage,
|
||||||
.tiling_flags = (1 << surf->tiling));
|
.tiling_flags = (1 << surf->tiling));
|
||||||
assert(ok);
|
assert(ok);
|
||||||
|
|
||||||
/* The newly created image represents the one subimage we're
|
/* The newly created image represents the one subimage we're
|
||||||
* referencing with this view so it only has one array slice and
|
* referencing with this view so it only has one array slice and
|
||||||
* miplevel.
|
* miplevel.
|
||||||
*/
|
*/
|
||||||
*ucompr_view = *view;
|
*ucompr_view = *view;
|
||||||
ucompr_view->base_array_layer = 0;
|
ucompr_view->base_array_layer = 0;
|
||||||
ucompr_view->base_level = 0;
|
ucompr_view->base_level = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue