diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index ddf1c1c51c4..187f17ccf1b 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -2454,24 +2454,19 @@ static VkResult lvp_image_plane_bind(struct lvp_device *device, struct lvp_image_plane *plane, struct lvp_device_memory *mem, - VkDeviceSize memory_offset, - VkDeviceSize *min_plane_offset) + VkDeviceSize memory_offset) { - VkDeviceSize plane_offset = MAX2(plane->offset, *min_plane_offset); - if (!device->pscreen->resource_bind_backing(device->pscreen, plane->bo, mem->pmem, 0, 0, - memory_offset + plane_offset)) { + memory_offset + plane->offset)) { /* This is probably caused by the texture being too large, so let's * report this as the *closest* allowed error-code. It's not ideal, * but it's unlikely that anyone will care too much. */ return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY); } - plane->offset = plane_offset; - *min_plane_offset = plane_offset + plane->size; return VK_SUCCESS; } @@ -2499,20 +2494,19 @@ lvp_image_bind(struct lvp_device *device, } assert(mem); - uint64_t offset_B = 0; if (image->disjoint) { const VkBindImagePlaneMemoryInfo *plane_info = vk_find_struct_const(bind_info->pNext, BIND_IMAGE_PLANE_MEMORY_INFO); const uint8_t plane = lvp_image_aspects_to_plane(image, plane_info->planeAspect); result = lvp_image_plane_bind(device, &image->planes[plane], mem, - mem_offset, &offset_B); + mem_offset); if (result != VK_SUCCESS) return result; } else { for (unsigned plane = 0; plane < image->plane_count; plane++) { result = lvp_image_plane_bind(device, &image->planes[plane], mem, - mem_offset, &offset_B); + mem_offset); if (result != VK_SUCCESS) return result; } diff --git a/src/gallium/frontends/lavapipe/lvp_image.c b/src/gallium/frontends/lavapipe/lvp_image.c index 21bcbef045c..52636feb4e6 100644 --- a/src/gallium/frontends/lavapipe/lvp_image.c +++ b/src/gallium/frontends/lavapipe/lvp_image.c @@ -164,6 +164,9 @@ lvp_image_init(struct lvp_device *device, struct lvp_image *image, } else #endif { + if (!image->disjoint) + image->planes[p].offset = image->size; + image->planes[p].bo = device->pscreen->resource_create_unbacked(device->pscreen, &template, &image->planes[p].size);