Mesa (staging/19.1): wsi: add minImageCount override
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 9 11:31:42 UTC 2019
Module: Mesa
Branch: staging/19.1
Commit: 4d5bcb4c33d4b018c3a71aee553908e6d1406871
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d5bcb4c33d4b018c3a71aee553908e6d1406871
Author: Eric Engestrom <eric.engestrom at intel.com>
Date: Thu Aug 29 23:49:29 2019 +0100
wsi: add minImageCount override
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl> (v1)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
(cherry picked from commit a72cdd00abd5f3c18df01acc60bf3b385facfdb6)
---
src/util/xmlpool/t_options.h | 5 +++++
src/vulkan/wsi/wsi_common.c | 2 +-
src/vulkan/wsi/wsi_common.h | 6 ++++++
src/vulkan/wsi/wsi_common_private.h | 3 ++-
src/vulkan/wsi/wsi_common_x11.c | 14 +++++++++++++-
5 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/util/xmlpool/t_options.h b/src/util/xmlpool/t_options.h
index c7ebd3a4600..69008320029 100644
--- a/src/util/xmlpool/t_options.h
+++ b/src/util/xmlpool/t_options.h
@@ -215,6 +215,11 @@ DRI_CONF_OPT_BEGIN_B(adaptive_sync,def) \
DRI_CONF_DESC(en,gettext("Adapt the monitor sync to the application performance (when possible)")) \
DRI_CONF_OPT_END
+#define DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(def) \
+DRI_CONF_OPT_BEGIN_V(vk_x11_override_min_image_count, int, def, "0:999") \
+ DRI_CONF_DESC(en,gettext("Override the VkSurfaceCapabilitiesKHR::minImageCount (0 = no override)")) \
+DRI_CONF_OPT_END
+
#define DRI_CONF_MESA_GLTHREAD(def) \
DRI_CONF_OPT_BEGIN_B(mesa_glthread, def) \
DRI_CONF_DESC(en,gettext("Enable offloading GL driver work to a separate thread")) \
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index d44b9fad542..db9aef335ed 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -101,7 +101,7 @@ wsi_device_init(struct wsi_device *wsi,
#undef WSI_GET_CB
#ifdef VK_USE_PLATFORM_XCB_KHR
- result = wsi_x11_init_wsi(wsi, alloc);
+ result = wsi_x11_init_wsi(wsi, alloc, dri_options);
if (result != VK_SUCCESS)
goto fail;
#endif
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 46e51286e09..b00fc3c1857 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -109,6 +109,12 @@ struct wsi_device {
* available. Not all window systems might support this. */
bool enable_adaptive_sync;
+ struct {
+ /* Override the minimum number of images on the swapchain.
+ * 0 = no override */
+ uint32_t override_minImageCount;
+ } x11;
+
uint64_t (*image_get_modifier)(VkImage image);
#define WSI_CB(cb) PFN_vk##cb cb
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 6d8f4b7a0e4..8384dbe9f91 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -138,7 +138,8 @@ struct wsi_interface {
};
VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc);
+ const VkAllocationCallbacks *alloc,
+ const struct driOptionCache *dri_options);
void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 6fa4dab1240..f79d454b73a 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -38,6 +38,7 @@
#include <xf86drm.h>
#include "drm-uapi/drm_fourcc.h"
#include "util/hash_table.h"
+#include "util/xmlconfig.h"
#include "vk_util.h"
#include "wsi_common_private.h"
@@ -511,6 +512,9 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
/* There is no real maximum */
caps->maxImageCount = 0;
+ if (wsi_device->x11.override_minImageCount)
+ caps->minImageCount = wsi_device->x11.override_minImageCount;
+
caps->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->maxImageArrayLayers = 1;
@@ -1546,7 +1550,8 @@ fail_alloc:
VkResult
wsi_x11_init_wsi(struct wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc)
+ const VkAllocationCallbacks *alloc,
+ const struct driOptionCache *dri_options)
{
struct wsi_x11 *wsi;
VkResult result;
@@ -1577,6 +1582,13 @@ wsi_x11_init_wsi(struct wsi_device *wsi_device,
goto fail_mutex;
}
+ if (dri_options) {
+ if (driCheckOption(dri_options, "vk_x11_override_min_image_count", DRI_INT)) {
+ wsi_device->x11.override_minImageCount =
+ driQueryOptioni(dri_options, "vk_x11_override_min_image_count");
+ }
+ }
+
wsi->base.get_support = x11_surface_get_support;
wsi->base.get_capabilities2 = x11_surface_get_capabilities2;
wsi->base.get_formats = x11_surface_get_formats;
More information about the mesa-commit
mailing list