summaryrefslogtreecommitdiffstats
path: root/src/vulkan
Commit message (Collapse)AuthorAgeFilesLines
* vulkan/wsi: Fix resource leak in success path of wsi_queue_init()Gwan-gyeong Mun2016-12-141-0/+1
| | | | | | | | | | It fixes leakage of pthread_condattr resource on wsi_queue_init() Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com> (cherry picked from commit 65ea559465df527d8a2998380c7eb2554780a2ba)
* vulkan/wsi/x11: Implement FIFO mode.Jason Ekstrand2016-11-281-10/+164
| | | | | | | | | | | | This implements VK_PRESENT_MODE_FIFO_KHR for X11. Unfortunately, due to the way the present extension works, we have to manage the queue of presented images in a separate thread. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit e73d136a02308088cacab842790c7670e5d07b23)
* vulkan/wsi: Add a thread-safe queue implementationKevin Strasser2016-11-282-1/+156
| | | | | | | | | | | | | | | | In order to support FIFO mode without blocking the application on calls to vkQueuePresentKHR it is necessary to enqueue the request and defer calling the server until the next vblank period. The xcb present api doesn't offer a way to register a callback, so we will have to spawn a worker thread that will wait for a request to be added to the queue, call to the server, and then make the image available for reuse. This commit introduces the queue data structure needed to implement this. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 932bb3f0ddf22a9cbdf6d45089547765027b4397)
* vulkan/wsi/x11: add support for IMMEDIATE present modeDave Airlie2016-11-281-1/+3
| | | | | | | | | We shouldn't be using ASYNC here, that would be used for immediate mode, so let's implement that. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit ca035006c86a5055c8e640f49c858f04770681eb)
* vulkan/wsi: store present mode in swapchain base classDave Airlie2016-11-283-3/+5
| | | | | | | | | This just moves this up a level as x11 will need it to implement things properly. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 1cdca1eb16ab33da338dda076794efd4bf859f7b)
* vulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)Dave Airlie2016-11-281-5/+57
| | | | | | | | | | | | | | For 0 timeout, just poll for an event, and if none, return For UINT64_MAX timeout, just wait for special event blocked For other timeouts get the xcb fd and block on it, decreasing the timeout if we get woken up for non-special events. v1.1: return VK_TIMEOUT for poll timeouts. handle timeout going negative. Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 787c172aed0ae88ca6a8c1a193d9dd744fbdc918)
* vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHREduardo Lima Mitev2016-11-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x11_surface_get_present_modes() is currently asserting that the number of elements in pPresentModeCount must be greater than or equal to the number of present modes available. This is buggy because pPresentModeCount elements are later copied from the internal modes' array, so if pPresentModeCount is greater, it will overflow it. On top of that, this assertion violates the spec. From the Vulkan 1.0 (revision 32, with KHR extensions), page 581 of the PDF: "If the value of pPresentModeCount is less than the number of presentation modes supported, at most pPresentModeCount values will be written. If pPresentModeCount is smaller than the number of presentation modes supported for the given surface, VK_INCOMPLETE will be returned instead of VK_SUCCESS to indicate that not all the available values were returned." So, the correct behavior is: if pPresentModeCount is greater than the internal number of formats, it is clamped to that many present modes. But if it is lesser than that, then pPresentModeCount elements are copied, and the call returns VK_INCOMPLETE. This fix is similar (but simpler and more readable) than the one I provided in 750d8cad72a for vkGetPhysicalDeviceSurfaceFormatsKHR, which was suffering from the same problem. Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (cherry picked from commit b677b99db5c48ffd1eeef538b962080ac5fd65d9) Nominated-by: Emil Velikov <emil.velikov@collabora.com>
* vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHREduardo Lima Mitev2016-11-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x11_surface_get_formats() is currently asserting that the number of elements in pSurfaceFormats must be greater than or equal to the number of formats available. This is buggy because pSurfaceFormatsCount elements are later copied from the internal formats' array, so if pSurfaceFormatCount is greater, it will overflow it. On top of that, this assertion violates the spec. From the Vulkan 1.0 (revision 32, with KHR extensions), page 579 of the PDF: "If pSurfaceFormats is NULL, then the number of format pairs supported for the given surface is returned in pSurfaceFormatCount. Otherwise, pSurfaceFormatCount must point to a variable set by the user to the number of elements in the pSurfaceFormats array, and on return the variable is overwritten with the number of structures actually written to pSurfaceFormats. If the value of pSurfaceFormatCount is less than the number of format pairs supported, at most pSurfaceFormatCount structures will be written. If pSurfaceFormatCount is smaller than the number of format pairs supported for the given surface, VK_INCOMPLETE will be returned instead of VK_SUCCESS to indicate that not all the available values were returned." So, the correct behavior is: if pSurfaceFormatCount is greater than the internal number of formats, it is clamped to that many formats. But if it is lesser than that, then pSurfaceFormatCount elements are copied, and the call returns VK_INCOMPLETE. Reviewed-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 750d8cad72a532d977df10ffbbdd1902bd06f50b) Nominated-by: Emil Velikov <emil.velikov@collabora.com> Squashed with commit: vulkan/wsi/x11: Smplify implementation of vkGetPhysicalDeviceSurfaceFormatsKHR This patch simplifies x11_surface_get_formats(). It is actually just a readability improvement over the patch I provided earlier this week (750d8cad72). Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (cherry picked from commit 129da274261b6e79f459e24428591f137bf92ed1)
* wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHRDave Airlie2016-11-242-10/+22
| | | | | | | | | | This fixes the x11 and wayland backends to not assert: dEQP-VK.wsi.xcb.swapchain.get_images.incomplete Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 253fa25d09b77e18f736b97da07d57be0e6c4200)
* vulkan/wsi: Report the correct min/maxImageCountJason Ekstrand2016-11-232-26/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | From the Vulkan spec 1.0.32 section 29.6 docs for vkAcquireNextImageKHR: "Let n be the total number of images in the swapchain, m be the value of VkSurfaceCapabilitiesKHR::minImageCount, and a be the number of presentable images that the application has currently acquired (i.e. images acquired with vkAcquireNextImageKHR, but not yet presented with vkQueuePresentKHR). vkAcquireNextImageKHR can always succeed if a ≤ n - m at the time vkAcquireNextImageKHR is called. vkAcquireNextImageKHR should not be called if a > n - m with a timeout of UINT64_MAX; in such a case, vkAcquireNextImageKHR may block indefinitely." With minImageCount == 2 (as it was previously, the client is allowed to acquire all but one image withoutblocking. If we really need 4 images for mailbox mode + pageflipping, then we need to request a minimum of 4 images up-front. This is a bit unfortunate because it means we will always consume 4 images. In the future, we may be able to optimize this a bit by waiting until the server starts to flip and returning OUT_OF_DATE to get the client to re-allocate with more images or something like that. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 4fa0ca80eeeac813affcbb0129ed61f1534d8df0)
* vulkan/wsi/wayland: Clean up some error handling pathsJason Ekstrand2016-11-231-0/+8
| | | | | | | | | This gets rid of all the memory leaks reported by the WSI CTS tests. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 302f641d14f5c4d1560b6a0170803e21bd4bb976)
* vulkan/wsi/wayland: Include pthread.hJason Ekstrand2016-11-231-0/+1
| | | | | | | | We use pthreads and, for some reason, it wasn't getting included Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 3b6abfc69ac485006cbedba7bcad234888cad44f)
* vulkan/wsi/x11: Clean up connections in finish_wsiJason Ekstrand2016-11-091-0/+4
| | | | | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit daeb21e47845795d0320811db1e202540fba356b)
* vulkan/wsi/x11: Better handle wsi_x11_connection_create failureJason Ekstrand2016-11-091-0/+2
| | | | | | | | | | | Without this fix, the function would still end up returning NULL but it would put that NULL connection in the hash table which would be bad. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit fc0e9e3e40e4b044ce1b62c1b757941f4ed4c820)
* vulkan/wsi/wayland: fix ARGB window supportFredrik Höglund2016-10-271-1/+4
| | | | | | | | | | | Use an ARGB format for the DRM buffer when the compositeAlpha field in VkSwapchainCreateInfoKHR is set to VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR. Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 68db0fe0346386c8d231eb81da6340b24b7878b0)
* vulkan/wsi/x11: fix ARGB window supportFredrik Höglund2016-10-271-4/+15
| | | | | | | | | | Pass the correct depth to xcb_dri3_pixmap_from_buffer_checked(). Otherwise xcb_present_pixmap() fails with a BadMatch error. Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 972670c2007c1c5a51b4f0876d31476858f79351)
* wsi/wayland: fix error pathEric Engestrom2016-10-241-0/+4
| | | | | | | | Fixes: 1720bbd353d87412754f ("anv/wsi: split image alloc/free out to separate fns.") Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Eric Engestrom <eric@engestrom.ch> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 8bf7717e1f84d180f42fb665772878d3b6d27459)
* vulkan/wsi: fix out of tree build.Dave Airlie2016-10-191-1/+1
|
* anv: move to using shared wsi codeDave Airlie2016-10-197-0/+1985
This moves the shared code to a common subdirectory and makes anv linked to that code instead of the copy it was using. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>