Read region information from VkPresentRegionsKHR.
Change-Id: I60668599de5331108066a5ba8630867684cea92e
Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
"vkGetDeviceGroupSurfacePresentModesKHR",
"vkGetPhysicalDevicePresentRectanglesKHR"
]
- }
+ },
+ {"name" : "VK_KHR_incremental_present", "spec_version" : "1"}
],
"enable_environment": {
"ENABLE_WSI_LAYER": "1"
}
VkResult ret = VK_SUCCESS;
+ const VkPresentRegionsKHR *regions = NULL;
+ VkBaseOutStructure *s;
+ for (s = (struct VkBaseOutStructure *)((void *)(pPresentInfo->pNext));s; s = s->pNext)
+ {
+ if (s->sType == VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR)
+ {
+ regions = (const VkPresentRegionsKHR *)s;
+ break;
+ }
+ }
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; ++i)
{
VkSwapchainKHR swapc = pPresentInfo->pSwapchains[i];
+ const VkPresentRegionKHR *region = NULL;
auto *sc = reinterpret_cast<wsi::swapchain_base *>(swapc);
assert(sc != nullptr);
- res = sc->queue_present(queue, present_info, pPresentInfo->pImageIndices[i]);
+ if (regions && regions->pRegions)
+ region = ®ions->pRegions[i];
+
+ VkResult res = sc->queue_present(queue, pPresentInfo, pPresentInfo->pImageIndices[i], region);
if (pPresentInfo->pResults != nullptr)
{
}
}
-VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const uint32_t image_index)
+VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const uint32_t image_index, const VkPresentRegionKHR *region)
{
VkResult result;
return result;
}
- present_image(image_index);
+ present_image(image_index, region);
return VK_SUCCESS;
}
* swapchain has a descendant who started presenting returns VK_ERROR_OUT_OF_DATE_KHR,
* otherwise returns VK_SUCCESS.
*/
- VkResult queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const uint32_t image_index);
+ VkResult queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const uint32_t image_index, const VkPresentRegionKHR *region);
protected:
* @param pending_index Index of the pending image to be presented.
*
*/
- virtual void present_image(uint32_t pending_index) = 0;
+ virtual void present_image(uint32_t pending_index, const VkPresentRegionKHR *region) = 0;
/**
* @brief Transition a presented image to free.
return VK_ERROR_SURFACE_LOST_KHR;
}
-void swapchain::present_image(uint32_t pendingIndex)
+void swapchain::present_image(uint32_t pendingIndex, const VkPresentRegionKHR *region)
{
tizen_image_data *image_data = reinterpret_cast<tizen_image_data *>(m_swapchain_images[pendingIndex].data);
- tpl_surface_enqueue_buffer_with_damage_and_sync(m_tpl_surface, image_data->tbm_buffer, 0, NULL, -1);
+ int *rects = NULL;
+ int rect_count = 0;
+
+ if (region)
+ {
+ rect_count = region->rectangleCount;
+ rects = new int[rect_count*4];
+ for (int i = 0; i < rect_count*4; i+=4)
+ {
+ rects[i] = region->pRectangles->offset.x;
+ rects[i+1] = region->pRectangles->offset.y;
+ rects[i+2] = region->pRectangles->extent.width;
+ rects[i+3] = region->pRectangles->extent.height;
+ }
+ }
+
+ tpl_surface_enqueue_buffer_with_damage_and_sync(m_tpl_surface, image_data->tbm_buffer, rect_count, rects, -1);
+ if (rects)
+ delete rects;
}
void swapchain::destroy_image(void)
*
* @param pendingIndex Index of the pending image to be presented.
*/
- void present_image(uint32_t pendingIndex) override;
+ void present_image(uint32_t pendingIndex, const VkPresentRegionKHR *region) override;
/**
* @brief Method to release a swapchain image