VkImage image{VK_NULL_HANDLE};
VkFence present_fence{VK_NULL_HANDLE};
-#ifdef USE_ICD_MALI_NIKEM
bool is_external{false};
-#endif
};
/**
* otherwise returns VK_SUCCESS.
*/
VkResult queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const uint32_t image_index, const VkPresentRegionKHR *region);
-#ifdef USE_ICD_MALI_NIKEM
+
VkResult create_swapchain_images(VkImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkImage* pImage);
VkResult bind_swapchain_images(const uint32_t image_index, VkImage image);
-#endif
+
protected:
layer::device_private_data &m_device_data;
* @param image Handle to the image about to be released.
*/
virtual void destroy_image(void){};
-#ifdef USE_ICD_MALI_NIKEM
virtual VkResult create_external_image(VkImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkImage* pImage) = 0;
virtual VkResult bind_external_image(const uint32_t image_index, VkImage image) = 0;
-#endif
};
} /* namespace wsi */
swapchain::~swapchain()
{
+ wsi_info("Release swapchain[%p]", this);
teardown();
destroy_image();
if (m_tpl_surface) {
return VK_ERROR_SURFACE_LOST_KHR;
m_tpl_surface = tpl_surface_get(m_tpl_display, vk_surf->surface);
- wsi_info("Get tpl_surface[%p] from tpl_display[%p]", m_tpl_surface, m_tpl_display);
+ wsi_info("Get tpl_surface[%p] from tpl_display[%p] for wl_surface[%p]", m_tpl_surface, m_tpl_display, vk_surf->surface);
if (m_tpl_surface == NULL) {
format = wsi_tizen_get_tbm_format(pSwapchainCreateInfo->imageFormat, pSwapchainCreateInfo->compositeAlpha);
m_tpl_surface = tpl_surface_create(m_tpl_display, vk_surf->surface, TPL_SURFACE_TYPE_WINDOW, format);
res = tpl_surface_create_swapchain(m_tpl_surface, format,
pSwapchainCreateInfo->imageExtent.width, pSwapchainCreateInfo->imageExtent.height,
pSwapchainCreateInfo->minImageCount, tpl_present_mode);
+ wsi_info("create swapchain with extent: width[%d], height[%d], image count[%d]",
+ pSwapchainCreateInfo->imageExtent.width, pSwapchainCreateInfo->imageExtent.height,
+ pSwapchainCreateInfo->minImageCount);
+
if (res != TPL_ERROR_NONE) {
wsi_error("create swapchain failed, ret[%d].\n", res);
+ if (res == TPL_ERROR_OUT_OF_MEMORY) {
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
return VK_ERROR_INITIALIZATION_FAILED;
}
}
tbm_bo bo = tbm_surface_internal_get_bo(buffers[i], 0);
- tbm_bo_handle bo_handle = tbm_bo_get_handle(bo, TBM_DEVICE_3D);
+ //tbm_bo_handle bo_handle = tbm_bo_get_handle(bo, TBM_DEVICE_3D);
image_data->tbm_buffer = buffers[i];
- image_data->buffer_fd = bo_handle.u32;//tbm_bo_export_fd(bo);
+ image_data->buffer_fd = tbm_bo_export_fd(bo);//bo_handle.u32;
image_data->memory = VK_NULL_HANDLE;
-
#ifndef USE_ICD_MALI_NIKEM
tbm_surface_info_s info;
tbm_surface_get_info(buffers[i], &info);
wsi_info("New image[%d] - tbm_buffer [%p], buffer fd [%d]", i, image_data->tbm_buffer, image_data->buffer_fd);
image.data = static_cast<void *>(image_data);
-#ifdef USE_ICD_MALI_NIKEM
image.is_external = false;
-#endif
result = allocate_image(image_create_info, image_data, &image.image);
if (result != VK_SUCCESS)
m_device_data.disp.DestroyFence(m_device, image.present_fence, get_allocation_callbacks());
image.present_fence = VK_NULL_HANDLE;
}
-#ifdef USE_ICD_MALI_NIKEM
+#if 1
if (image.image != VK_NULL_HANDLE && !image.is_external)
#else
if (image.image != VK_NULL_HANDLE)
{
m_device_data.disp.FreeMemory(m_device, image_data->memory, get_allocation_callbacks());
}
- else if (image_data->buffer_fd >= 0)
+ if (image_data->buffer_fd >= 0)
{
close(image_data->buffer_fd);
}
}
}
-#ifdef USE_ICD_MALI_NIKEM
VkResult swapchain::create_external_image(VkImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkImage* pImage)
{
return result;
}
-#endif
} // namespace wayland
} // namespace wsi