vulkan/wsi: replace prime_blit_buffer by a bool

venus only needs to know if a WSI image is a prime blit source.  In an
upcoming swapchain image rework, the prime blit destination is unknown
when the WSI image is created.  Replace prime_blit_buffer by a bool.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12046>
This commit is contained in:
Chia-I Wu 2021-07-23 14:31:30 -07:00
parent 890b1c0f2a
commit bd9550b026
5 changed files with 8 additions and 9 deletions

View file

@ -132,7 +132,7 @@ vn_cmd_fix_image_memory_barrier(const struct vn_command_buffer *cmd,
return;
/* prime blit src or no layout transition */
if (img->prime_blit_buffer != VK_NULL_HANDLE ||
if (img->is_prime_blit_src ||
out_barrier->oldLayout == out_barrier->newLayout) {
if (out_barrier->oldLayout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)
out_barrier->oldLayout = VN_PRESENT_SRC_INTERNAL_LAYOUT;
@ -1228,8 +1228,9 @@ vn_CmdCopyImageToBuffer(VkCommandBuffer commandBuffer,
VN_PRESENT_SRC_INTERNAL_LAYOUT != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) {
srcImageLayout = VN_PRESENT_SRC_INTERNAL_LAYOUT;
/* sanity check */
const struct vn_image *img = vn_image_from_handle(srcImage);
prime_blit = img->is_wsi && img->prime_blit_buffer == dstBuffer;
prime_blit = img->is_wsi && img->is_prime_blit_src;
assert(prime_blit);
}

View file

@ -33,7 +33,7 @@ struct vn_image {
VkMemoryDedicatedRequirements dedicated_requirements[4];
bool is_wsi;
VkBuffer prime_blit_buffer;
bool is_prime_blit_src;
/* For VK_ANDROID_native_buffer, the WSI image owns the memory, */
VkDeviceMemory private_memory;

View file

@ -122,7 +122,7 @@ vn_wsi_create_image(struct vn_device *dev,
return result;
img->is_wsi = true;
img->prime_blit_buffer = wsi_info->prime_blit_buffer;
img->is_prime_blit_src = wsi_info->prime_blit_src;
*out_img = img;
return VK_SUCCESS;

View file

@ -47,10 +47,8 @@ struct wsi_image_create_info {
const void *pNext;
bool scanout;
/* If set, the buffer is the prime blit destination and the image is the
* source.
*/
VkBuffer prime_blit_buffer;
/* if true, the image is a prime blit source */
bool prime_blit_src;
};
struct wsi_memory_allocate_info {

View file

@ -502,7 +502,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
const struct wsi_image_create_info image_wsi_info = {
.sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
.prime_blit_buffer = image->prime.buffer,
.prime_blit_src = true,
};
const VkImageCreateInfo image_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,