mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
wsi/x11: Fix a misunderstanding about how xcb_get_geometry works
The code here is well-intentioned, but the only way a GetGeometry request can fail is if you name an invalid drawable. And if we did that, either our internal state got corrupted, or - more likely - the user destroyed the window. In either case there's nothing more we can do with the surface, so report that it's been lost. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13104>
This commit is contained in:
parent
ac783acd74
commit
aa30e58600
1 changed files with 7 additions and 20 deletions
|
|
@ -605,20 +605,11 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
|
|||
caps->currentExtent = extent;
|
||||
caps->minImageExtent = extent;
|
||||
caps->maxImageExtent = extent;
|
||||
} else {
|
||||
/* This can happen if the client didn't wait for the configure event
|
||||
* to come back from the compositor. In that case, we don't know the
|
||||
* size of the window so we just return valid "I don't know" stuff.
|
||||
*/
|
||||
caps->currentExtent = (VkExtent2D) { UINT32_MAX, UINT32_MAX };
|
||||
caps->minImageExtent = (VkExtent2D) { 1, 1 };
|
||||
caps->maxImageExtent = (VkExtent2D) {
|
||||
wsi_device->maxImageDimension2D,
|
||||
wsi_device->maxImageDimension2D,
|
||||
};
|
||||
}
|
||||
free(err);
|
||||
free(geom);
|
||||
if (!geom)
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
|
||||
if (visual_has_alpha(visual, visual_depth)) {
|
||||
caps->supportedCompositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR |
|
||||
|
|
@ -657,6 +648,9 @@ x11_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface,
|
|||
x11_surface_get_capabilities(icd_surface, wsi_device,
|
||||
&caps->surfaceCapabilities);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
vk_foreach_struct(ext, caps->pNext) {
|
||||
switch (ext->sType) {
|
||||
case VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR: {
|
||||
|
|
@ -772,17 +766,10 @@ x11_surface_get_present_rectangles(VkIcdSurfaceBase *icd_surface,
|
|||
.offset = { 0, 0 },
|
||||
.extent = { geom->width, geom->height },
|
||||
};
|
||||
} else {
|
||||
/* This can happen if the client didn't wait for the configure event
|
||||
* to come back from the compositor. In that case, we don't know the
|
||||
* size of the window so we just return valid "I don't know" stuff.
|
||||
*/
|
||||
*rect = (VkRect2D) {
|
||||
.offset = { 0, 0 },
|
||||
.extent = { UINT32_MAX, UINT32_MAX },
|
||||
};
|
||||
}
|
||||
free(geom);
|
||||
if (!geom)
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue