summaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-04-28 01:50:36 +0200
committerBas Nieuwenhuizen <[email protected]>2019-05-19 00:38:03 +0000
commit4689e98fe884d9412b72fd6293b6d6a69e3ef68e (patch)
tree905e866730a1af5adb88d50a3335de5cc6e7c1f4 /src/vulkan/wsi
parentccb8ea7acfb710c6c5298f3ffcadbe3d79b9b913 (diff)
vulkan/wsi: Set X11 minImageCount to 3.
For IMMEDIATE and FIFO, most games work in a pipelined manner where the can produce frames at a rate of 1/MAX(CPU duration, GPU duration), but the render latency is CPU duration + GPU duration. This means that with scanout from pageflipping we need 3 frames to run full speed: 1) CPU rendering work 2) GPU rendering work 3) scanout Once we have a nonblocking acquire that returns a semaphore we can merge 1 and 3. Hence the ideal implementation needs only 2 images, but games cannot tellwe currently do not have an ideal implementation and that hence they need to allocate 3 images. So let us do it for them. This is a tradeoff as it uses more memory than needed for non-fullscreen and non-performance intensive applications. Since this is pretty much a TODO that can use the context I added this as a comment. Acked-by: Jason Ekstrand <[email protected]> Acked-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/vulkan/wsi')
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 46f1c08b453..96aba03aca2 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -501,13 +501,25 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
}
- /* For true mailbox mode, we need at least 4 images:
- * 1) One to scan out from
- * 2) One to have queued for scan-out
- * 3) One to be currently held by the X server
- * 4) One to render to
+ /* For IMMEDIATE and FIFO, most games work in a pipelined manner where the
+ * can produce frames at a rate of 1/MAX(CPU duration, GPU duration), but
+ * the render latency is CPU duration + GPU duration.
+ *
+ * This means that with scanout from pageflipping we need 3 frames to run
+ * full speed:
+ * 1) CPU rendering work
+ * 2) GPU rendering work
+ * 3) scanout
+ *
+ * Once we have a nonblocking acquire that returns a semaphore we can merge
+ * 1 and 3. Hence the ideal implementation needs only 2 images, but games
+ * cannot tellwe currently do not have an ideal implementation and that
+ * hence they need to allocate 3 images. So let us do it for them.
+ *
+ * This is a tradeoff as it uses more memory than needed for non-fullscreen
+ * and non-performance intensive applications.
*/
- caps->minImageCount = 2;
+ caps->minImageCount = 3;
/* There is no real maximum */
caps->maxImageCount = 0;