else
                        *array_mode = RADEON_SURF_MODE_LINEAR_ALIGNED;
 
-               *is_scanout = metadata->u.gfx9.swizzle_mode == 0 ||
-                             metadata->u.gfx9.swizzle_mode % 4 == 2;
-
                surf->u.gfx9.surf.swizzle_mode = metadata->u.gfx9.swizzle_mode;
+               *is_scanout = metadata->u.gfx9.scanout;
 
                if (metadata->u.gfx9.dcc_offset_256B) {
                        surf->u.gfx9.display_dcc_pitch_max = metadata->u.gfx9.dcc_pitch_max;
 
        if (sscreen->info.chip_class >= GFX9) {
                md.u.gfx9.swizzle_mode = surface->u.gfx9.surf.swizzle_mode;
+               md.u.gfx9.scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0;
 
                if (tex->surface.dcc_offset && !tex->dcc_separate_buffer) {
                        uint64_t dcc_offset =
 
        if (sscreen->info.chip_class >= GFX8 &&
            G_008F28_COMPRESSION_EN(desc[6])) {
-               /* Read DCC information.
-                *
-                * Some state trackers don't set the SCANOUT flag when
-                * importing displayable images, which affects PIPE_ALIGNED
-                * and RB_ALIGNED, so we need to recover them here.
-                */
+               /* Read DCC information. */
                switch (sscreen->info.chip_class) {
                case GFX8:
                        tex->surface.dcc_offset = (uint64_t)desc[7] << 8;
                        /* If DCC is unaligned, this can only be a displayable image. */
                        if (!tex->surface.u.gfx9.dcc.pipe_aligned &&
                            !tex->surface.u.gfx9.dcc.rb_aligned)
-                               tex->surface.is_displayable = true;
+                               assert(tex->surface.is_displayable);
                        break;
 
                case GFX10:
 
    }
 }
 
+#define AMDGPU_TILING_SCANOUT_SHIFT            63
+#define AMDGPU_TILING_SCANOUT_MASK             0x1
+
 static void amdgpu_buffer_get_metadata(struct pb_buffer *_buf,
                                        struct radeon_bo_metadata *md)
 {
       md->u.gfx9.dcc_offset_256B = AMDGPU_TILING_GET(tiling_flags, DCC_OFFSET_256B);
       md->u.gfx9.dcc_pitch_max = AMDGPU_TILING_GET(tiling_flags, DCC_PITCH_MAX);
       md->u.gfx9.dcc_independent_64B = AMDGPU_TILING_GET(tiling_flags, DCC_INDEPENDENT_64B);
+      md->u.gfx9.scanout = AMDGPU_TILING_GET(tiling_flags, SCANOUT);
    } else {
       md->u.legacy.microtile = RADEON_LAYOUT_LINEAR;
       md->u.legacy.macrotile = RADEON_LAYOUT_LINEAR;
       tiling_flags |= AMDGPU_TILING_SET(DCC_OFFSET_256B, md->u.gfx9.dcc_offset_256B);
       tiling_flags |= AMDGPU_TILING_SET(DCC_PITCH_MAX, md->u.gfx9.dcc_pitch_max);
       tiling_flags |= AMDGPU_TILING_SET(DCC_INDEPENDENT_64B, md->u.gfx9.dcc_independent_64B);
+      tiling_flags |= AMDGPU_TILING_SET(SCANOUT, md->u.gfx9.scanout);
    } else {
       if (md->u.legacy.macrotile == RADEON_LAYOUT_TILED)
          tiling_flags |= AMDGPU_TILING_SET(ARRAY_MODE, 4); /* 2D_TILED_THIN1 */