Re: [Mesa-dev] [PATCH] r600: fix cubemap arrays

2017-11-15 Thread Marc Dietrich
Hi Dave,

Am Dienstag, 14. November 2017, 23:28:38 CET schrieb Dave Airlie:
> From: Dave Airlie 
> 
> A lot of cubemap array piglits fail, port the texture type
> picking code from radeonsi which seems to fix most of them.
> 
> For images I will port the rest of the code.
> 
> Fixes:
> getteximage-depth gl_texture_cube_map_array-*
> fbo-generatemipmap-cubemap array
> getteximage-targets cube_array
> amongst others.

getteximage-depth still fails on r600 < eg. All others are skipped due to 
missing cube_array support. Can this also be fixed?

Marc


> 
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/drivers/r600/evergreen_state.c | 26 +-
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_state.c
> b/src/gallium/drivers/r600/evergreen_state.c index 68977bb..b02d7ee 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -169,9 +169,20 @@ static uint32_t r600_translate_blend_factor(int
> blend_fact) return 0;
>  }
> 
> -static unsigned r600_tex_dim(unsigned dim, unsigned nr_samples)
> +static unsigned r600_tex_dim(struct r600_texture *rtex,
> +  unsigned view_target, unsigned nr_samples)
>  {
> - switch (dim) {
> + unsigned res_target = rtex->resource.b.b.target;
> +
> + if (view_target == PIPE_TEXTURE_CUBE ||
> + view_target == PIPE_TEXTURE_CUBE_ARRAY)
> + res_target = view_target;
> + /* If interpreting cubemaps as something else, set 2D_ARRAY. */
> + else if (res_target == PIPE_TEXTURE_CUBE ||
> +  res_target == PIPE_TEXTURE_CUBE_ARRAY)
> + res_target = PIPE_TEXTURE_2D_ARRAY;
> +
> + switch (res_target) {
>   default:
>   case PIPE_TEXTURE_1D:
>   return V_03_SQ_TEX_DIM_1D;
> @@ -805,13 +816,10 @@ static int evergreen_fill_tex_resource_words(struct
> r600_context *rctx, va = tmp->resource.gpu_address;
> 
>   /* array type views and views into array types need to use layer offset 
> */
> - dim = params->target;
> - if (params->target != PIPE_TEXTURE_CUBE)
> - dim = MAX2(params->target, texture->target);
> -
> - tex_resource_words[0] = (S_03_DIM(r600_tex_dim(dim,
> texture->nr_samples)) | -
> S_03_PITCH((pitch / 8) - 1) |
> -S_03_TEX_WIDTH(width - 1));
> + dim = r600_tex_dim(tmp, params->target, texture->nr_samples);
> + tex_resource_words[0] = (S_03_DIM(dim) |
> +  S_03_PITCH((pitch / 8) - 1) |
> +  S_03_TEX_WIDTH(width - 1));
>   if (rscreen->b.chip_class == CAYMAN)
>   tex_resource_words[0] |=
> CM_S_03_NON_DISP_TILING_ORDER(non_disp_tiling); else



signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] r600: fix cubemap arrays

2017-11-14 Thread Roland Scheidegger
Makes sense.

Reviewed-by: Roland Scheidegger 

Am 14.11.2017 um 23:28 schrieb Dave Airlie:
> From: Dave Airlie 
> 
> A lot of cubemap array piglits fail, port the texture type
> picking code from radeonsi which seems to fix most of them.
> 
> For images I will port the rest of the code.
> 
> Fixes:
> getteximage-depth gl_texture_cube_map_array-*
> fbo-generatemipmap-cubemap array
> getteximage-targets cube_array
> amongst others.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/drivers/r600/evergreen_state.c | 26 +-
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_state.c 
> b/src/gallium/drivers/r600/evergreen_state.c
> index 68977bb..b02d7ee 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -169,9 +169,20 @@ static uint32_t r600_translate_blend_factor(int 
> blend_fact)
>   return 0;
>  }
>  
> -static unsigned r600_tex_dim(unsigned dim, unsigned nr_samples)
> +static unsigned r600_tex_dim(struct r600_texture *rtex,
> +  unsigned view_target, unsigned nr_samples)
>  {
> - switch (dim) {
> + unsigned res_target = rtex->resource.b.b.target;
> +
> + if (view_target == PIPE_TEXTURE_CUBE ||
> + view_target == PIPE_TEXTURE_CUBE_ARRAY)
> + res_target = view_target;
> + /* If interpreting cubemaps as something else, set 2D_ARRAY. */
> + else if (res_target == PIPE_TEXTURE_CUBE ||
> +  res_target == PIPE_TEXTURE_CUBE_ARRAY)
> + res_target = PIPE_TEXTURE_2D_ARRAY;
> +
> + switch (res_target) {
>   default:
>   case PIPE_TEXTURE_1D:
>   return V_03_SQ_TEX_DIM_1D;
> @@ -805,13 +816,10 @@ static int evergreen_fill_tex_resource_words(struct 
> r600_context *rctx,
>   va = tmp->resource.gpu_address;
>  
>   /* array type views and views into array types need to use layer offset 
> */
> - dim = params->target;
> - if (params->target != PIPE_TEXTURE_CUBE)
> - dim = MAX2(params->target, texture->target);
> -
> - tex_resource_words[0] = (S_03_DIM(r600_tex_dim(dim, 
> texture->nr_samples)) |
> -S_03_PITCH((pitch / 8) - 1) |
> -S_03_TEX_WIDTH(width - 1));
> + dim = r600_tex_dim(tmp, params->target, texture->nr_samples);
> + tex_resource_words[0] = (S_03_DIM(dim) |
> +  S_03_PITCH((pitch / 8) - 1) |
> +  S_03_TEX_WIDTH(width - 1));
>   if (rscreen->b.chip_class == CAYMAN)
>   tex_resource_words[0] |= 
> CM_S_03_NON_DISP_TILING_ORDER(non_disp_tiling);
>   else
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600: fix cubemap arrays

2017-11-14 Thread Dave Airlie
From: Dave Airlie 

A lot of cubemap array piglits fail, port the texture type
picking code from radeonsi which seems to fix most of them.

For images I will port the rest of the code.

Fixes:
getteximage-depth gl_texture_cube_map_array-*
fbo-generatemipmap-cubemap array
getteximage-targets cube_array
amongst others.

Signed-off-by: Dave Airlie 
---
 src/gallium/drivers/r600/evergreen_state.c | 26 +-
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 68977bb..b02d7ee 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -169,9 +169,20 @@ static uint32_t r600_translate_blend_factor(int blend_fact)
return 0;
 }
 
-static unsigned r600_tex_dim(unsigned dim, unsigned nr_samples)
+static unsigned r600_tex_dim(struct r600_texture *rtex,
+unsigned view_target, unsigned nr_samples)
 {
-   switch (dim) {
+   unsigned res_target = rtex->resource.b.b.target;
+
+   if (view_target == PIPE_TEXTURE_CUBE ||
+   view_target == PIPE_TEXTURE_CUBE_ARRAY)
+   res_target = view_target;
+   /* If interpreting cubemaps as something else, set 2D_ARRAY. */
+   else if (res_target == PIPE_TEXTURE_CUBE ||
+res_target == PIPE_TEXTURE_CUBE_ARRAY)
+   res_target = PIPE_TEXTURE_2D_ARRAY;
+
+   switch (res_target) {
default:
case PIPE_TEXTURE_1D:
return V_03_SQ_TEX_DIM_1D;
@@ -805,13 +816,10 @@ static int evergreen_fill_tex_resource_words(struct 
r600_context *rctx,
va = tmp->resource.gpu_address;
 
/* array type views and views into array types need to use layer offset 
*/
-   dim = params->target;
-   if (params->target != PIPE_TEXTURE_CUBE)
-   dim = MAX2(params->target, texture->target);
-
-   tex_resource_words[0] = (S_03_DIM(r600_tex_dim(dim, 
texture->nr_samples)) |
-  S_03_PITCH((pitch / 8) - 1) |
-  S_03_TEX_WIDTH(width - 1));
+   dim = r600_tex_dim(tmp, params->target, texture->nr_samples);
+   tex_resource_words[0] = (S_03_DIM(dim) |
+S_03_PITCH((pitch / 8) - 1) |
+S_03_TEX_WIDTH(width - 1));
if (rscreen->b.chip_class == CAYMAN)
tex_resource_words[0] |= 
CM_S_03_NON_DISP_TILING_ORDER(non_disp_tiling);
else
-- 
2.9.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev