Commit e8e54443 authored by Eric Engestrom's avatar Eric Engestrom 💤
Browse files

wsi: query the ICD's max dimensions instead of hard-coding them



anv and radv both happened to already return 2^14 for these, but
querying the ICD is safer and will help if vdreno (or whatever it's
called) doesn't have the same max.
Signed-off-by: Eric Engestrom's avatarEric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
parent b031c643
Pipeline #18275 passed with stages
in 60 minutes and 57 seconds
......@@ -58,6 +58,8 @@ wsi_device_init(struct wsi_device *wsi,
};
GetPhysicalDeviceProperties2(pdevice, &pdp2);
wsi->maxImageDimension2D = pdp2.properties.limits.maxImageDimension2D;
GetPhysicalDeviceMemoryProperties(pdevice, &wsi->memory_props);
GetPhysicalDeviceQueueFamilyProperties(pdevice, &wsi->queue_family_count, NULL);
......@@ -734,7 +736,7 @@ wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
};
VkResult result = iface->get_capabilities2(surface, NULL, &caps2);
VkResult result = iface->get_capabilities2(surface, wsi_device, NULL, &caps2);
if (result == VK_SUCCESS)
*pSurfaceCapabilities = caps2.surfaceCapabilities;
......@@ -750,7 +752,7 @@ wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device,
ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pSurfaceInfo->surface);
struct wsi_interface *iface = wsi_device->wsi[surface->platform];
return iface->get_capabilities2(surface, pSurfaceInfo->pNext,
return iface->get_capabilities2(surface, wsi_device, pSurfaceInfo->pNext,
pSurfaceCapabilities);
}
......@@ -777,7 +779,7 @@ wsi_common_get_surface_capabilities2ext(
.pNext = &counters,
};
VkResult result = iface->get_capabilities2(surface, NULL, &caps2);
VkResult result = iface->get_capabilities2(surface, wsi_device, NULL, &caps2);
if (result == VK_SUCCESS) {
VkSurfaceCapabilities2EXT *ext_caps = pSurfaceCapabilities;
......
......@@ -100,6 +100,8 @@ struct wsi_device {
VkPhysicalDevicePCIBusInfoPropertiesEXT pci_bus_info;
bool supports_modifiers;
uint32_t maxImageDimension2D;
uint64_t (*image_get_modifier)(VkImage image);
#define WSI_CB(cb) PFN_vk##cb cb
......
......@@ -811,6 +811,7 @@ wsi_display_surface_get_support(VkIcdSurfaceBase *surface,
static VkResult
wsi_display_surface_get_capabilities(VkIcdSurfaceBase *surface_base,
struct wsi_device *wsi_device,
VkSurfaceCapabilitiesKHR* caps)
{
VkIcdSurfaceDisplay *surface = (VkIcdSurfaceDisplay *) surface_base;
......@@ -819,8 +820,11 @@ wsi_display_surface_get_capabilities(VkIcdSurfaceBase *surface_base,
caps->currentExtent.width = mode->hdisplay;
caps->currentExtent.height = mode->vdisplay;
/* XXX Figure out extents based on driver capabilities */
caps->maxImageExtent = caps->minImageExtent = caps->currentExtent;
caps->minImageExtent = (VkExtent2D) { 1, 1 };
caps->maxImageExtent = (VkExtent2D) {
wsi_device->maxImageDimension2D,
wsi_device->maxImageDimension2D,
};
caps->supportedCompositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
......@@ -851,13 +855,14 @@ wsi_display_surface_get_surface_counters(
static VkResult
wsi_display_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface,
struct wsi_device *wsi_device,
const void *info_next,
VkSurfaceCapabilities2KHR *caps)
{
assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
VkResult result;
result = wsi_display_surface_get_capabilities(icd_surface,
result = wsi_display_surface_get_capabilities(icd_surface, wsi_device,
&caps->surfaceCapabilities);
if (result != VK_SUCCESS)
return result;
......
......@@ -106,6 +106,7 @@ struct wsi_interface {
uint32_t queueFamilyIndex,
VkBool32* pSupported);
VkResult (*get_capabilities2)(VkIcdSurfaceBase *surface,
struct wsi_device *wsi_device,
const void *info_next,
VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
VkResult (*get_formats)(VkIcdSurfaceBase *surface,
......
......@@ -480,6 +480,7 @@ static const VkPresentModeKHR present_modes[] = {
static VkResult
wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
struct wsi_device *wsi_device,
VkSurfaceCapabilitiesKHR* caps)
{
/* For true mailbox mode, we need at least 4 images:
......@@ -494,8 +495,11 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
caps->currentExtent = (VkExtent2D) { -1, -1 };
caps->minImageExtent = (VkExtent2D) { 1, 1 };
/* This is the maximum supported size on Intel */
caps->maxImageExtent = (VkExtent2D) { 1 << 14, 1 << 14 };
caps->maxImageExtent = (VkExtent2D) {
wsi_device->maxImageDimension2D,
wsi_device->maxImageDimension2D,
};
caps->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->maxImageArrayLayers = 1;
......@@ -516,12 +520,14 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
static VkResult
wsi_wl_surface_get_capabilities2(VkIcdSurfaceBase *surface,
struct wsi_device *wsi_device,
const void *info_next,
VkSurfaceCapabilities2KHR* caps)
{
assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
return wsi_wl_surface_get_capabilities(surface, &caps->surfaceCapabilities);
return wsi_wl_surface_get_capabilities(surface, wsi_device,
&caps->surfaceCapabilities);
}
static VkResult
......
......@@ -451,6 +451,7 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
static VkResult
x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
struct wsi_device *wsi_device,
VkSurfaceCapabilitiesKHR *caps)
{
xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
......@@ -484,8 +485,10 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
*/
caps->currentExtent = (VkExtent2D) { -1, -1 };
caps->minImageExtent = (VkExtent2D) { 1, 1 };
/* This is the maximum supported size on Intel */
caps->maxImageExtent = (VkExtent2D) { 1 << 14, 1 << 14 };
caps->maxImageExtent = (VkExtent2D) {
wsi_device->maxImageDimension2D,
wsi_device->maxImageDimension2D,
};
}
free(err);
free(geom);
......@@ -523,12 +526,13 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
static VkResult
x11_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface,
struct wsi_device *wsi_device,
const void *info_next,
VkSurfaceCapabilities2KHR *caps)
{
assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
return x11_surface_get_capabilities(icd_surface, &caps->surfaceCapabilities);
return x11_surface_get_capabilities(icd_surface, wsi_device, &caps->surfaceCapabilities);
}
static VkResult
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment