mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
nvk: Take an nvk_image_plane in nouveau_copy_rect_image
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
8d712c2e06
commit
62fa4ff5e0
2 changed files with 31 additions and 21 deletions
|
|
@ -68,9 +68,9 @@ vk_to_nil_extent(VkExtent3D extent, uint32_t array_layers)
|
||||||
static struct nouveau_copy_buffer
|
static struct nouveau_copy_buffer
|
||||||
nouveau_copy_rect_image(
|
nouveau_copy_rect_image(
|
||||||
struct nvk_image *img,
|
struct nvk_image *img,
|
||||||
|
struct nvk_image_plane *plane,
|
||||||
VkOffset3D offset_px,
|
VkOffset3D offset_px,
|
||||||
const VkImageSubresourceLayers *sub_res,
|
const VkImageSubresourceLayers *sub_res)
|
||||||
const uint8_t plane)
|
|
||||||
{
|
{
|
||||||
const VkExtent3D lvl_extent_px =
|
const VkExtent3D lvl_extent_px =
|
||||||
vk_image_mip_level_extent(&img->vk, sub_res->mipLevel);
|
vk_image_mip_level_extent(&img->vk, sub_res->mipLevel);
|
||||||
|
|
@ -82,17 +82,17 @@ nouveau_copy_rect_image(
|
||||||
vk_to_nil_offset(offset_px, sub_res->baseArrayLayer);
|
vk_to_nil_offset(offset_px, sub_res->baseArrayLayer);
|
||||||
|
|
||||||
struct nouveau_copy_buffer buf = {
|
struct nouveau_copy_buffer buf = {
|
||||||
.base_addr = nvk_image_base_address(img, plane) +
|
.base_addr = nvk_image_plane_base_address(plane) +
|
||||||
img->planes[plane].nil.levels[sub_res->mipLevel].offset_B,
|
plane->nil.levels[sub_res->mipLevel].offset_B,
|
||||||
.image_type = img->vk.image_type,
|
.image_type = img->vk.image_type,
|
||||||
.offset_el = nil_offset4d_px_to_el(offset4d_px, img->planes[plane].nil.format,
|
.offset_el = nil_offset4d_px_to_el(offset4d_px, plane->nil.format,
|
||||||
img->planes[plane].nil.sample_layout),
|
plane->nil.sample_layout),
|
||||||
.extent_el = nil_extent4d_px_to_el(lvl_extent4d_px, img->planes[plane].nil.format,
|
.extent_el = nil_extent4d_px_to_el(lvl_extent4d_px, plane->nil.format,
|
||||||
img->planes[plane].nil.sample_layout),
|
plane->nil.sample_layout),
|
||||||
.bpp = util_format_get_blocksize(img->planes[plane].nil.format),
|
.bpp = util_format_get_blocksize(plane->nil.format),
|
||||||
.row_stride = img->planes[plane].nil.levels[sub_res->mipLevel].row_stride_B,
|
.row_stride = plane->nil.levels[sub_res->mipLevel].row_stride_B,
|
||||||
.array_stride = img->planes[plane].nil.array_stride_B,
|
.array_stride = plane->nil.array_stride_B,
|
||||||
.tiling = img->planes[plane].nil.levels[sub_res->mipLevel].tiling,
|
.tiling = plane->nil.levels[sub_res->mipLevel].tiling,
|
||||||
};
|
};
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
@ -373,8 +373,9 @@ nvk_CmdCopyBufferToImage2(VkCommandBuffer commandBuffer,
|
||||||
struct nouveau_copy copy = {
|
struct nouveau_copy copy = {
|
||||||
.src = nouveau_copy_rect_buffer(src, region->bufferOffset,
|
.src = nouveau_copy_rect_buffer(src, region->bufferOffset,
|
||||||
buffer_layout),
|
buffer_layout),
|
||||||
.dst = nouveau_copy_rect_image(dst, region->imageOffset,
|
.dst = nouveau_copy_rect_image(dst, &dst->planes[plane],
|
||||||
®ion->imageSubresource, plane),
|
region->imageOffset,
|
||||||
|
®ion->imageSubresource),
|
||||||
.extent_el = nil_extent4d_px_to_el(extent4d_px, dst->planes[plane].nil.format,
|
.extent_el = nil_extent4d_px_to_el(extent4d_px, dst->planes[plane].nil.format,
|
||||||
dst->planes[plane].nil.sample_layout),
|
dst->planes[plane].nil.sample_layout),
|
||||||
};
|
};
|
||||||
|
|
@ -443,8 +444,9 @@ nvk_CmdCopyImageToBuffer2(VkCommandBuffer commandBuffer,
|
||||||
uint8_t plane = nvk_image_aspects_to_plane(src, aspects);
|
uint8_t plane = nvk_image_aspects_to_plane(src, aspects);
|
||||||
|
|
||||||
struct nouveau_copy copy = {
|
struct nouveau_copy copy = {
|
||||||
.src = nouveau_copy_rect_image(src, region->imageOffset,
|
.src = nouveau_copy_rect_image(src, &src->planes[plane],
|
||||||
®ion->imageSubresource, plane),
|
region->imageOffset,
|
||||||
|
®ion->imageSubresource),
|
||||||
.dst = nouveau_copy_rect_buffer(dst, region->bufferOffset,
|
.dst = nouveau_copy_rect_buffer(dst, region->bufferOffset,
|
||||||
buffer_layout),
|
buffer_layout),
|
||||||
.extent_el = nil_extent4d_px_to_el(extent4d_px, src->planes[plane].nil.format,
|
.extent_el = nil_extent4d_px_to_el(extent4d_px, src->planes[plane].nil.format,
|
||||||
|
|
@ -522,10 +524,12 @@ nvk_CmdCopyImage2(VkCommandBuffer commandBuffer,
|
||||||
uint8_t dst_plane = nvk_image_aspects_to_plane(dst, dst_aspects);
|
uint8_t dst_plane = nvk_image_aspects_to_plane(dst, dst_aspects);
|
||||||
|
|
||||||
struct nouveau_copy copy = {
|
struct nouveau_copy copy = {
|
||||||
.src = nouveau_copy_rect_image(src, region->srcOffset,
|
.src = nouveau_copy_rect_image(src, &src->planes[src_plane],
|
||||||
®ion->srcSubresource, src_plane),
|
region->srcOffset,
|
||||||
.dst = nouveau_copy_rect_image(dst, region->dstOffset,
|
®ion->srcSubresource),
|
||||||
®ion->dstSubresource, dst_plane),
|
.dst = nouveau_copy_rect_image(dst, &dst->planes[dst_plane],
|
||||||
|
region->dstOffset,
|
||||||
|
®ion->dstSubresource),
|
||||||
.extent_el = nil_extent4d_px_to_el(extent4d_px, src->planes[src_plane].nil.format,
|
.extent_el = nil_extent4d_px_to_el(extent4d_px, src->planes[src_plane].nil.format,
|
||||||
src->planes[src_plane].nil.sample_layout),
|
src->planes[src_plane].nil.sample_layout),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,16 @@ struct nvk_image {
|
||||||
|
|
||||||
VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
|
VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
nvk_image_plane_base_address(const struct nvk_image_plane *plane)
|
||||||
|
{
|
||||||
|
return plane->mem->bo->offset + plane->offset;
|
||||||
|
}
|
||||||
|
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
nvk_image_base_address(const struct nvk_image *image, uint8_t plane)
|
nvk_image_base_address(const struct nvk_image *image, uint8_t plane)
|
||||||
{
|
{
|
||||||
return image->planes[plane].mem->bo->offset + image->planes[plane].offset;
|
return nvk_image_plane_base_address(&image->planes[plane]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8_t
|
static inline uint8_t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue