Commit 84f18bb2 authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

venus: add more logs for Android WSI debugging


Signed-off-by: Yiwei Zhang's avatarYiwei Zhang <zzyiwei@chromium.org>
parent 01fa90b4
Pipeline #350145 waiting for manual action with stages
......@@ -236,8 +236,10 @@ vn_android_get_dma_buf_from_native_handle(const native_handle_t *handle,
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
}
if (handle->data[0] < 0)
if (handle->data[0] < 0) {
vn_log(NULL, "handle->data[0] < 0");
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
}
*out_dma_buf = handle->data[0];
return VK_SUCCESS;
......@@ -251,11 +253,15 @@ vn_android_get_gralloc_buffer_properties(
static const int32_t CROS_GRALLOC_DRM_GET_BUFFER_INFO = 4;
struct cros_gralloc0_buffer_info info;
if (gralloc->perform(gralloc, CROS_GRALLOC_DRM_GET_BUFFER_INFO, handle,
&info) != 0)
&info) != 0) {
vn_log(NULL, "CROS_GRALLOC_DRM_GET_BUFFER_INFO failed");
return false;
}
if (info.modifier == DRM_FORMAT_MOD_INVALID)
if (info.modifier == DRM_FORMAT_MOD_INVALID) {
vn_log(NULL, "Unexpected DRM_FORMAT_MOD_INVALID");
return false;
}
out_props->drm_fourcc = info.drm_fourcc;
for (uint32_t i = 0; i < 4; i++) {
......@@ -418,13 +424,18 @@ vn_android_image_from_anb(struct vn_device *dev,
/* encoder will strip the Android specific pNext structs */
result = vn_image_create(dev, &builder.create, alloc, &img);
if (result != VK_SUCCESS)
if (result != VK_SUCCESS) {
if (VN_DEBUG(WSI))
vn_log(dev->instance, "vn_image_create failed");
goto fail;
}
image = vn_image_to_handle(img);
VkMemoryRequirements mem_req;
vn_GetImageMemoryRequirements(device, image, &mem_req);
if (!mem_req.memoryTypeBits) {
if (VN_DEBUG(WSI))
vn_log(dev->instance, "mem_req.memoryTypeBits cannot be zero");
result = VK_ERROR_INVALID_EXTERNAL_HANDLE;
goto fail;
}
......@@ -442,6 +453,11 @@ vn_android_image_from_anb(struct vn_device *dev,
}
if (alloc_size < mem_req.size) {
if (VN_DEBUG(WSI)) {
vn_log(dev->instance,
"alloc_size(%" PRIu64 ") mem_req.size(%" PRIu64 ")",
alloc_size, mem_req.size);
}
result = VK_ERROR_INVALID_EXTERNAL_HANDLE;
goto fail;
}
......@@ -473,14 +489,19 @@ vn_android_image_from_anb(struct vn_device *dev,
};
result = vn_AllocateMemory(device, &memory_info, alloc, &memory);
if (result != VK_SUCCESS) {
if (VN_DEBUG(WSI))
vn_log(dev->instance, "vn_AllocateMemory failed");
/* only need to close the dup_fd on import failure */
close(dup_fd);
goto fail;
}
result = vn_BindImageMemory(device, image, memory, 0);
if (result != VK_SUCCESS)
if (result != VK_SUCCESS) {
if (VN_DEBUG(WSI))
vn_log(dev->instance, "vn_BindImageMemory failed");
goto fail;
}
img->is_wsi = true;
/* Android WSI image owns the memory */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment