From: Sagar Ghuge Date: Tue, 16 Jul 2019 17:38:00 +0000 (-0700) Subject: iris: Add helper function to get isl dim layout X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e816991cc3c8baebbbff2f64e91202728c696e0;p=mesa.git iris: Add helper function to get isl dim layout v2: Add missing space (Caio) Signed-off-by: Sagar Ghuge Reviewed-by: Kenneth Graunke --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index d4360523294..ec59436df79 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -253,6 +253,35 @@ iris_get_depth_stencil_resources(struct pipe_resource *res, } } +enum isl_dim_layout +iris_get_isl_dim_layout(const struct gen_device_info *devinfo, + enum isl_tiling tiling, + enum pipe_texture_target target) +{ + switch (target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_1D_ARRAY: + return (devinfo->gen >= 9 && tiling == ISL_TILING_LINEAR ? + ISL_DIM_LAYOUT_GEN9_1D : ISL_DIM_LAYOUT_GEN4_2D); + + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_2D_ARRAY: + case PIPE_TEXTURE_RECT: + case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: + return ISL_DIM_LAYOUT_GEN4_2D; + + case PIPE_TEXTURE_3D: + return (devinfo->gen >= 9 ? + ISL_DIM_LAYOUT_GEN4_2D : ISL_DIM_LAYOUT_GEN4_3D); + + case PIPE_MAX_TEXTURE_TYPES: + case PIPE_BUFFER: + break; + } + unreachable("invalid texture type"); +} + void iris_resource_disable_aux(struct iris_resource *res) { diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h index a233d57e32b..707c559025c 100644 --- a/src/gallium/drivers/iris/iris_resource.h +++ b/src/gallium/drivers/iris/iris_resource.h @@ -392,6 +392,9 @@ iris_resource_access_raw(struct iris_context *ice, } } +enum isl_dim_layout iris_get_isl_dim_layout(const struct gen_device_info *devinfo, + enum isl_tiling tiling, + enum pipe_texture_target target); enum isl_aux_usage iris_resource_texture_aux_usage(struct iris_context *ice, const struct iris_resource *res, enum isl_format view_fmt,