crocus/gen4: restrict memcpy mapping to gen5
authorDave Airlie <airlied@redhat.com>
Mon, 26 Jul 2021 05:27:52 +0000 (15:27 +1000)
committerMarge Bot <eric+marge@anholt.net>
Mon, 26 Jul 2021 20:28:37 +0000 (20:28 +0000)
This is due to gen4 + 4.5 having some rather strange swizzling
that we can't actually detect properly in userspace

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12058>

src/gallium/drivers/crocus/crocus_resource.c

index e81356b..f189f1a 100644 (file)
@@ -1577,6 +1577,7 @@ crocus_transfer_map(struct pipe_context *ctx,
    struct crocus_context *ice = (struct crocus_context *)ctx;
    struct crocus_resource *res = (struct crocus_resource *)resource;
    struct isl_surf *surf = &res->surf;
+   struct crocus_screen *screen = (struct crocus_screen *)ctx->screen;
 
    if (usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE) {
       /* Replace the backing storage with a fresh buffer for non-async maps */
@@ -1690,7 +1691,7 @@ crocus_transfer_map(struct pipe_context *ctx,
       if (surf->tiling == ISL_TILING_W) {
          /* TODO: Teach crocus_map_tiled_memcpy about W-tiling... */
          crocus_map_s8(map);
-      } else if (surf->tiling != ISL_TILING_LINEAR) {
+      } else if (surf->tiling != ISL_TILING_LINEAR && screen->devinfo.ver > 4) {
          crocus_map_tiled_memcpy(map);
       } else {
          crocus_map_direct(map);