[Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
From: Marek Olšák Cc: 17.2 17.3 --- src/gallium/drivers/radeon/r600_texture.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 34b3ab0..36eff40 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -291,25 +291,35 @@ static int r600_init_surface(struct si_screen *sscreen, flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE; if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe, array_mode, surface); if (r) { return r; } + unsigned pitch = pitch_in_bytes_override / bpe; + if (sscreen->info.chip_class >= GFX9) { - assert(!pitch_in_bytes_override || - pitch_in_bytes_override == surface->u.gfx9.surf_pitch * bpe); + if (pitch) { + surface->u.gfx9.surf_pitch = pitch; + surface->u.gfx9.surf_slice_size = + (uint64_t)pitch * surface->u.gfx9.surf_height * bpe; + } surface->u.gfx9.surf_offset = offset; } else { + if (pitch) { + surface->u.legacy.level[0].nblk_x = pitch; + surface->u.legacy.level[0].slice_size_dw = + ((uint64_t)pitch * surface->u.legacy.level[0].nblk_y * bpe) / 4; + } if (offset) { for (i = 0; i < ARRAY_SIZE(surface->u.legacy.level); ++i) surface->u.legacy.level[i].offset += offset; } } return 0; } static void r600_texture_init_metadata(struct si_screen *sscreen, struct r600_texture *rtex, -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
Tested-by: Dieter Nützel on RX580 with UH, UV, glmark2 and Blender 2.79 with and without nir. Dieter Am 10.01.2018 20:49, schrieb Marek Olšák: From: Marek Olšák Cc: 17.2 17.3 --- src/gallium/drivers/radeon/r600_texture.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 34b3ab0..36eff40 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -291,25 +291,35 @@ static int r600_init_surface(struct si_screen *sscreen, flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE; if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe, array_mode, surface); if (r) { return r; } + unsigned pitch = pitch_in_bytes_override / bpe; + if (sscreen->info.chip_class >= GFX9) { - assert(!pitch_in_bytes_override || - pitch_in_bytes_override == surface->u.gfx9.surf_pitch * bpe); + if (pitch) { + surface->u.gfx9.surf_pitch = pitch; + surface->u.gfx9.surf_slice_size = + (uint64_t)pitch * surface->u.gfx9.surf_height * bpe; + } surface->u.gfx9.surf_offset = offset; } else { + if (pitch) { + surface->u.legacy.level[0].nblk_x = pitch; + surface->u.legacy.level[0].slice_size_dw = + ((uint64_t)pitch * surface->u.legacy.level[0].nblk_y * bpe) / 4; + } if (offset) { for (i = 0; i < ARRAY_SIZE(surface->u.legacy.level); ++i) surface->u.legacy.level[i].offset += offset; } } return 0; } static void r600_texture_init_metadata(struct si_screen *sscreen, struct r600_texture *rtex, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
I know. It's not been formally reviewed yet though. marek On Fri, Jan 19, 2018 at 4:34 AM, Dieter Nützel wrote: > Ping! > > > Am 11.01.2018 04:45, schrieb Dieter Nützel: >> >> Tested-by: Dieter Nützel >> >> on RX580 with UH, UV, glmark2 and Blender 2.79 with and without nir. >> >> Dieter >> >> Am 10.01.2018 20:49, schrieb Marek Olšák: >>> >>> From: Marek Olšák >>> >>> Cc: 17.2 17.3 >>> --- >>> src/gallium/drivers/radeon/r600_texture.c | 14 -- >>> 1 file changed, 12 insertions(+), 2 deletions(-) >>> >>> diff --git a/src/gallium/drivers/radeon/r600_texture.c >>> b/src/gallium/drivers/radeon/r600_texture.c >>> index 34b3ab0..36eff40 100644 >>> --- a/src/gallium/drivers/radeon/r600_texture.c >>> +++ b/src/gallium/drivers/radeon/r600_texture.c >>> @@ -291,25 +291,35 @@ static int r600_init_surface(struct si_screen >>> *sscreen, >>> flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE; >>> if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) >>> flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; >>> >>> r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe, >>> array_mode, surface); >>> if (r) { >>> return r; >>> } >>> >>> + unsigned pitch = pitch_in_bytes_override / bpe; >>> + >>> if (sscreen->info.chip_class >= GFX9) { >>> - assert(!pitch_in_bytes_override || >>> - pitch_in_bytes_override == >>> surface->u.gfx9.surf_pitch * bpe); >>> + if (pitch) { >>> + surface->u.gfx9.surf_pitch = pitch; >>> + surface->u.gfx9.surf_slice_size = >>> + (uint64_t)pitch * >>> surface->u.gfx9.surf_height * bpe; >>> + } >>> surface->u.gfx9.surf_offset = offset; >>> } else { >>> + if (pitch) { >>> + surface->u.legacy.level[0].nblk_x = pitch; >>> + surface->u.legacy.level[0].slice_size_dw = >>> + ((uint64_t)pitch * >>> surface->u.legacy.level[0].nblk_y * bpe) / 4; >>> + } >>> if (offset) { >>> for (i = 0; i < >>> ARRAY_SIZE(surface->u.legacy.level); ++i) >>> surface->u.legacy.level[i].offset += >>> offset; >>> } >>> } >>> return 0; >>> } >>> >>> static void r600_texture_init_metadata(struct si_screen *sscreen, >>>struct r600_texture *rtex, >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
Ping! Am 11.01.2018 04:45, schrieb Dieter Nützel: Tested-by: Dieter Nützel on RX580 with UH, UV, glmark2 and Blender 2.79 with and without nir. Dieter Am 10.01.2018 20:49, schrieb Marek Olšák: From: Marek Olšák Cc: 17.2 17.3 --- src/gallium/drivers/radeon/r600_texture.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 34b3ab0..36eff40 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -291,25 +291,35 @@ static int r600_init_surface(struct si_screen *sscreen, flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE; if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe, array_mode, surface); if (r) { return r; } + unsigned pitch = pitch_in_bytes_override / bpe; + if (sscreen->info.chip_class >= GFX9) { - assert(!pitch_in_bytes_override || - pitch_in_bytes_override == surface->u.gfx9.surf_pitch * bpe); + if (pitch) { + surface->u.gfx9.surf_pitch = pitch; + surface->u.gfx9.surf_slice_size = + (uint64_t)pitch * surface->u.gfx9.surf_height * bpe; + } surface->u.gfx9.surf_offset = offset; } else { + if (pitch) { + surface->u.legacy.level[0].nblk_x = pitch; + surface->u.legacy.level[0].slice_size_dw = + ((uint64_t)pitch * surface->u.legacy.level[0].nblk_y * bpe) / 4; + } if (offset) { for (i = 0; i < ARRAY_SIZE(surface->u.legacy.level); ++i) surface->u.legacy.level[i].offset += offset; } } return 0; } static void r600_texture_init_metadata(struct si_screen *sscreen, struct r600_texture *rtex, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
On 10.01.2018 20:49, Marek Olšák wrote: From: Marek Olšák Please add a bug report or reference to what fails without it. It does make sense though, so Reviewed-by: Nicolai Hähnle Cc: 17.2 17.3 --- src/gallium/drivers/radeon/r600_texture.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 34b3ab0..36eff40 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -291,25 +291,35 @@ static int r600_init_surface(struct si_screen *sscreen, flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE; if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe, array_mode, surface); if (r) { return r; } + unsigned pitch = pitch_in_bytes_override / bpe; + if (sscreen->info.chip_class >= GFX9) { - assert(!pitch_in_bytes_override || - pitch_in_bytes_override == surface->u.gfx9.surf_pitch * bpe); + if (pitch) { + surface->u.gfx9.surf_pitch = pitch; + surface->u.gfx9.surf_slice_size = + (uint64_t)pitch * surface->u.gfx9.surf_height * bpe; + } surface->u.gfx9.surf_offset = offset; } else { + if (pitch) { + surface->u.legacy.level[0].nblk_x = pitch; + surface->u.legacy.level[0].slice_size_dw = + ((uint64_t)pitch * surface->u.legacy.level[0].nblk_y * bpe) / 4; + } if (offset) { for (i = 0; i < ARRAY_SIZE(surface->u.legacy.level); ++i) surface->u.legacy.level[i].offset += offset; } } return 0; } static void r600_texture_init_metadata(struct si_screen *sscreen, struct r600_texture *rtex, -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: don't ignore pitch for imported textures
On Mon, Jan 22, 2018 at 2:09 PM, Nicolai Hähnle wrote: > On 10.01.2018 20:49, Marek Olšák wrote: >> >> From: Marek Olšák > > > Please add a bug report or reference to what fails without it. There is no bug report. I just noticed this in the code. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev