summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2019-03-02 17:25:22 +0000
committerLionel Landwerlin <[email protected]>2019-05-02 17:02:07 +0100
commit7ba50d80408080a94d605673efb5b870520dea87 (patch)
treeb4b36e7133e503a03d100af5c7f7b37e5b072222 /src/vulkan
parentea7a6fa98055ada285894ddea106d8292db55393 (diff)
vulkan/overlay: add no display option
In case you're just interested in data being record to the output file. Signed-off-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/overlay-layer/overlay.cpp66
-rw-r--r--src/vulkan/overlay-layer/overlay_params.c7
-rw-r--r--src/vulkan/overlay-layer/overlay_params.h2
3 files changed, 50 insertions, 25 deletions
diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp
index 266da9ebb8e..2aa0bf93e6b 100644
--- a/src/vulkan/overlay-layer/overlay.cpp
+++ b/src/vulkan/overlay-layer/overlay.cpp
@@ -1468,9 +1468,11 @@ static void before_present(struct swapchain_data *swapchain_data,
unsigned n_wait_semaphores,
unsigned imageIndex)
{
+ struct instance_data *instance_data = swapchain_data->device->instance;
+
snapshot_swapchain_frame(swapchain_data);
- if (swapchain_data->n_frames > 0) {
+ if (!instance_data->params.no_display && swapchain_data->n_frames > 0) {
compute_swapchain_display(swapchain_data);
render_swapchain_display(swapchain_data, wait_semaphores, n_wait_semaphores, imageIndex);
}
@@ -1509,6 +1511,7 @@ VKAPI_ATTR VkResult VKAPI_CALL overlay_QueuePresentKHR(
{
struct queue_data *queue_data = FIND_QUEUE_DATA(queue);
struct device_data *device_data = queue_data->device;
+ struct instance_data *instance_data = device_data->instance;
uint32_t query_results[OVERLAY_QUERY_COUNT];
if (list_length(&queue_data->running_command_buffer) > 0) {
@@ -1569,30 +1572,43 @@ VKAPI_ATTR VkResult VKAPI_CALL overlay_QueuePresentKHR(
* be have incomplete overlay drawings.
*/
VkResult result = VK_SUCCESS;
- for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
- VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
- struct swapchain_data *swapchain_data = FIND_SWAPCHAIN_DATA(swapchain);
- VkPresentInfoKHR present_info = *pPresentInfo;
- present_info.swapchainCount = 1;
- present_info.pSwapchains = &swapchain;
-
- before_present(swapchain_data,
- pPresentInfo->pWaitSemaphores,
- pPresentInfo->waitSemaphoreCount,
- pPresentInfo->pImageIndices[i]);
- /* Because the submission of the overlay draw waits on the semaphores
- * handed for present, we don't need to have this present operation wait
- * on them as well, we can just wait on the overlay submission
- * semaphore.
- */
- present_info.pWaitSemaphores = &swapchain_data->submission_semaphore;
- present_info.waitSemaphoreCount = 1;
-
- VkResult chain_result = queue_data->device->vtable.QueuePresentKHR(queue, &present_info);
- if (pPresentInfo->pResults)
- pPresentInfo->pResults[i] = chain_result;
- if (chain_result != VK_SUCCESS && result == VK_SUCCESS)
- result = chain_result;
+ if (instance_data->params.no_display) {
+ for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
+ VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
+ struct swapchain_data *swapchain_data = FIND_SWAPCHAIN_DATA(swapchain);
+
+ before_present(swapchain_data,
+ pPresentInfo->pWaitSemaphores,
+ pPresentInfo->waitSemaphoreCount,
+ pPresentInfo->pImageIndices[i]);
+ }
+ result = queue_data->device->vtable.QueuePresentKHR(queue, pPresentInfo);
+ } else {
+ for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
+ VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
+ struct swapchain_data *swapchain_data = FIND_SWAPCHAIN_DATA(swapchain);
+ VkPresentInfoKHR present_info = *pPresentInfo;
+ present_info.swapchainCount = 1;
+ present_info.pSwapchains = &swapchain;
+
+ before_present(swapchain_data,
+ pPresentInfo->pWaitSemaphores,
+ pPresentInfo->waitSemaphoreCount,
+ pPresentInfo->pImageIndices[i]);
+ /* Because the submission of the overlay draw waits on the semaphores
+ * handed for present, we don't need to have this present operation
+ * wait on them as well, we can just wait on the overlay submission
+ * semaphore.
+ */
+ present_info.pWaitSemaphores = &swapchain_data->submission_semaphore;
+ present_info.waitSemaphoreCount = 1;
+
+ VkResult chain_result = queue_data->device->vtable.QueuePresentKHR(queue, &present_info);
+ if (pPresentInfo->pResults)
+ pPresentInfo->pResults[i] = chain_result;
+ if (chain_result != VK_SUCCESS && result == VK_SUCCESS)
+ result = chain_result;
+ }
}
return result;
}
diff --git a/src/vulkan/overlay-layer/overlay_params.c b/src/vulkan/overlay-layer/overlay_params.c
index 51f85309574..16cf5b8dee0 100644
--- a/src/vulkan/overlay-layer/overlay_params.c
+++ b/src/vulkan/overlay-layer/overlay_params.c
@@ -54,6 +54,12 @@ parse_fps_sampling_period(const char *str)
}
static bool
+parse_no_display(const char *str)
+{
+ return strtol(str, NULL, 0) != 0;
+}
+
+static bool
parse_help(const char *str)
{
fprintf(stderr, "Layer params using VK_LAYER_MESA_OVERLAY_CONFIG=\n");
@@ -65,6 +71,7 @@ parse_help(const char *str)
#undef OVERLAY_PARAM_CUSTOM
fprintf(stderr, "\tposition=top-left|top-right|bottom-left|bottom-right\n");
fprintf(stderr, "\tfps_sampling_period=number-of-milliseconds\n");
+ fprintf(stderr, "\tno_display=0|1\n");
return true;
}
diff --git a/src/vulkan/overlay-layer/overlay_params.h b/src/vulkan/overlay-layer/overlay_params.h
index 37dfb26dcb6..9a3d5be1b9b 100644
--- a/src/vulkan/overlay-layer/overlay_params.h
+++ b/src/vulkan/overlay-layer/overlay_params.h
@@ -64,6 +64,7 @@ extern "C" {
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_file) \
OVERLAY_PARAM_CUSTOM(position) \
+ OVERLAY_PARAM_CUSTOM(no_display) \
OVERLAY_PARAM_CUSTOM(help)
enum overlay_param_position {
@@ -88,6 +89,7 @@ struct overlay_params {
FILE *output_file;
uint32_t fps_sampling_period; /* us */
bool help;
+ bool no_display;
};
const extern char *overlay_param_names[];