struct nouveau_copy {
struct nouveau_copy_buffer src;
struct nouveau_copy_buffer dst;
- struct {
+ struct nouveau_copy_remap {
uint8_t comp_size;
uint8_t dst[4];
} remap;
return buf;
}
+static struct nouveau_copy_remap
+nouveau_copy_remap_format(VkFormat format)
+{
+ /* Pick an arbitrary component size. It doesn't matter what size we
+ * pick since we're just doing a copy, as long as it's no more than 4B
+ * and divides the format size.
+ */
+ unsigned comp_size = vk_format_get_blocksize(format);
+ if (comp_size % 3 == 0) {
+ comp_size /= 3;
+ assert(util_is_power_of_two_nonzero(comp_size) && comp_size <= 4);
+ } else {
+ assert(util_is_power_of_two_nonzero(comp_size) && comp_size <= 16);
+ comp_size = MIN2(comp_size, 4);
+ }
+
+ return (struct nouveau_copy_remap) {
+ .comp_size = comp_size,
+ .dst = { 0, 1, 2, 3 },
+ };
+}
+
static uint32_t
to_90b5_remap_comp_size(uint8_t comp_size)
{
}
break;
default:
+ copy.remap = nouveau_copy_remap_format(dst->vk.format);
break;
}
}
break;
default:
+ copy.remap = nouveau_copy_remap_format(src->vk.format);
break;
}
}
break;
default:
+ copy.remap = nouveau_copy_remap_format(src->vk.format);
break;
}