radeonsi: Fix offset for linear surfaces on GFX < 9
authorDavid Rosca <nowrep@gmail.com>
Tue, 31 Oct 2023 09:13:52 +0000 (10:13 +0100)
committerEric Engestrom <eric@engestrom.ch>
Mon, 6 Nov 2023 09:37:47 +0000 (09:37 +0000)
Fixes: 86262b6eac0 ("radeonsi,radv: fix usages of surf_pitch")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9949
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10073
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25970>
(cherry picked from commit bf364cbdb40f044d2a11b6fe5636e8a039fdad81)

.pick_status.json
src/gallium/drivers/radeonsi/si_texture.c

index 8429aa363e38111718e637f3962f445fea78ebcc..28a61b306e9beab792c8d6aae2dd2bbd0a12b3f9 100644 (file)
@@ -64,7 +64,7 @@
         "description": "radeonsi: Fix offset for linear surfaces on GFX < 9",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "86262b6eac0c232f4b3085cfc86cff9b7de7d11b",
         "notes": null
index 16948db41a76c87e4806c4a12e80e32147f9fdf6..6003b71f40fc89affc93f88f6f8b0b72c072988d 100644 (file)
@@ -640,7 +640,9 @@ static bool si_resource_get_param(struct pipe_screen *screen, struct pipe_contex
       if (resource->target == PIPE_BUFFER) {
          *value = 0;
       } else {
-         uint64_t level_offset = tex->surface.is_linear ? tex->surface.u.gfx9.offset[level] : 0;
+         uint64_t level_offset = 0;
+         if (sscreen->info.gfx_level >= GFX9 && tex->surface.is_linear)
+            level_offset = tex->surface.u.gfx9.offset[level];
          *value = ac_surface_get_plane_offset(sscreen->info.gfx_level,
                                               &tex->surface, plane, layer)  + level_offset;
       }