summaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi
Commit message (Collapse)AuthorAgeFilesLines
* util/vulkan: Move Vulkan utilities to src/vulkan/utilAlex Smith2017-06-063-3/+3
| | | | | | | | | | | | | We have Vulkan utilities in both src/util and src/vulkan/util. The latter seems a more appropriate place for Vulkan-specific things, so move them there. v2: Android build system changes (from Tapani Pälli) Signed-off-by: Alex Smith <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* vulkan/wsi/wayland: Fix proxy wrappers for swapchain recreationPhilipp Zabel2017-05-201-3/+10
| | | | | | | | | | | | | | Before the swapchain event queue is destroyed, all proxy objects that reference it must be dropped. Otherwise we risk a use-after-free if a frame callback event or buffer release events are received afterwards. This happens when an application destroys and recreates a swapchain in FIFO mode between two frames without using the VkSwapchainCreateInfoKHR::oldSwapchain mechanism to keep the old swapchain until after the next redraw. Fixes: 5034c615582a ("vulkan/wsi/wayland: Use proxy wrappers for swapchain") Signed-off-by: Philipp Zabel <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Cc: [email protected]
* vulkan/wsi/wayland: Use proxy wrappers for swapchainDaniel Stone2017-05-191-16/+36
| | | | | | | | | | | | | | Though most swapchain operations used a queue, they were racy in that the object was created with the queue only set later, meaning that its event could potentially be dispatched from the default queue in between these two steps. Use proxy wrappers to avoid this race, also assigning wl_buffers created for the swapchain to the event queue. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: [email protected]
* vulkan/wsi/wayland: Use per-display event queueDaniel Stone2017-05-191-12/+32
| | | | | | | | | | Calling random callbacks on the display's event queue is hostile, as we may call into client code when it least expects it. Create our own event queue, one per wsi_wl_display, and use that for the registry. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: [email protected]
* vulkan/wsi/wayland: Remove roundtrip when creating imageDaniel Stone2017-05-191-1/+0
| | | | | | | | | | | | | There's no need to call wl_display_roundtrip() after trying to create a buffer through wl_drm; if it succeeds then everything is fine, and if it fails, then we get a fatal protocol error so can't recover anyway. Additionally, doing a roundtrip on the default / main application queue, is destructive anyway, so would need to be its own queue. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: [email protected]
* vulkan: Fix Wayland uninitialised registryDaniel Stone2017-05-191-4/+5
| | | | | | | | | Untangle the exit cleanup paths so we don't try to use the registry variable before it's been initialised. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: [email protected]
* vulkan/wsi/wayland: Add support for VK_KHR_get_surface_capabilities2Jason Ekstrand2017-05-161-0/+38
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* vulkan/wsi/x11: Add support for VK_KHR_get_surface_capabilities2Jason Ekstrand2017-05-161-0/+32
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* vulkan/wsi: Add get_capabilities2 and get_formats2d interface pointersJason Ekstrand2017-05-161-0/+8
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* vulkan/wsi: Use vk_outarray for surface_get_formatsJason Ekstrand2017-05-162-30/+21
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* vulkan/wsi/wayland: Pass damage through to the compositorJason Ekstrand2017-04-031-1/+15
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: Plumb present regions through the common codeJason Ekstrand2017-04-033-3/+6
| | | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Acked-by: Dave Airlie <[email protected]>
* vulkan/wsi: Fix some line wrappingJason Ekstrand2017-04-031-1/+4
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: Generate wayland protocol headers separately from EGLJason Ekstrand2017-03-132-1/+3
| | | | | | | | | | | | | | | | Previously, we were depending on EGL for generating the headers and providing the protocol symbols. However, since neither Vulkan driver actually wants to link against EGL, this is kind of pointless. It also creates a weird build dependency. v2 [Jason] - Add missing wsi/ prefix, MKDIR_GEN v3 [Emil Velikov] - include BUILT_SOURCES/generation rules outside of conditional Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan/wsi: Improve the DRI3 error messageJacob Lifshay2017-03-011-10/+41
| | | | | | | | | | | | | | | | | This commit improves the message by telling them that they could probably enable DRI3. More importantly, it includes a little heuristic to check to see if we're running on AMD or NVIDIA's proprietary X11 drivers and, if we are, doesn't emit the warning. This way, users with both a discrete card and Intel graphics don't get the warning when they're just running on the discrete card. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99715 Co-authored-by: Jason Ekstrand <[email protected]> Reviewed-by: Kai Wasserbäch <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Tested-by: Rene Lindsay <[email protected]> Acked-by: Dave Airlie <[email protected]> Cc: "17.0" <[email protected]>
* vulkan/wsi/radv: add initial prime support (v1.1)Dave Airlie2017-02-274-5/+69
| | | | | | | | | | | | | | | | | | | This is a complete rewrite of my previous rfc patches. This adds the ability to present to a different GPU that rendering using a driver side operation that can copy from the tiled to linear shared image. This does prime support completely in the swapchain present code, and each queue has a precreated command buffer for each image and for the each queue family. This means presenting should work on graphics and compute queues and transfer in the future. v1.1: initialise needs_linear_copy in swapchain. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Tested-by: Mike Lothian <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi: move image count to shared structure.Dave Airlie2017-02-233-26/+24
| | | | | | | | | For prime support I need to access this, so move it in advance. [airlied: fix int->uint32_t] Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan: Combine wsi and util makefilesDylan Baker2017-02-222-62/+0
| | | | Reviewed-by: Matt Turner <[email protected]>
* vulkan/wsi/x11: add support to detect if we can support rendering (v3)Dave Airlie2017-02-205-1/+74
| | | | | | | | | | | | | | | | | This adds support to radv_GetPhysicalDeviceXlibPresentationSupportKHR and radv_GetPhysicalDeviceXcbPresentationSupportKHR to check if the local device file descriptor is compatible with the descriptor retrieved from the X server via DRI3. This will stop radv binding to an X server until we have prime support in place. Hopefully apps use this API before trying to render things. v2: drop unneeded function, don't leak memory. (jekstrand) v3: also check in surface_get_support callback. Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi: Lower the maximum image sizesJason Ekstrand2017-01-252-2/+4
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Cc: "17.0" <[email protected]>
* vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetPresentModesJason Ekstrand2017-01-251-3/+5
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Cc: "17.0" <[email protected]>
* vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetFormatsJason Ekstrand2017-01-251-7/+9
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Cc: "17.0" <[email protected]>
* vulkan/wsi: clarify the severity of lack of DRI3 v2Andres Rodriguez2017-01-191-2/+4
| | | | | | | | | | | | | The current message sounds like a small warning, clarify that it can result in lack of presentation support and application crashes. v2: add "if they do" (Bas) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98263 Signed-off-by: Andres Rodriguez <[email protected]> Acked-by: Jason ekstrand <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* vulkan: Add new cast macros for VkIcd typesChad Versace2017-01-123-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't import the latest vk_icd.h because the new header breaks the Mesa build. This patch defines new casting macros, ICD_DEFINE_NONDISP_HANDLE_CASTS() and ICD_FROM_HANDLE(), which can handle both the old and new vk_icd.h, and will prevent the build from breaking when we update the header. In the old vk_icd.h, types were defined as: typedef struct _VkIcdFoo { ... } VkIcdFoo; Commit 6ebba1f6 in the Vulkan loader changed the above to typedef { ... } VkIcdFoo; because the old definitions violated the C and C++ specs. According to the specs, identifiers that begins with an underscore followed by an uppercase letter are reserved. (It's pedantic, I know), See the Github issue referenced below. References: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/7 References: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/commit/6ebba1f630015af7a78767a15c1e74ba9b23601c Reviewed-by: Emil Velikov <[email protected]> Cc: [email protected]
* vulkan/wsi/x11: don't crash on null wsi x11 connectionArda Coskunses2016-12-221-0/+3
| | | | | | | | | Without this check driver crash when application window closed unexpectedly. Acked-by: Edward O'Callaghan <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/x11: don't crash on null visualArda Coskunses2016-12-221-0/+3
| | | | | | | | | | When application window closed unexpectedly due to lost window visualtypes getting invlaid parameters which is causing a crash. Necessary check is added to prevent the crash. Reviewed-by: Jason Ekstrand <[email protected]> Cc: "13.0" <[email protected]>
* vulkan: use STATIC_ASSERT instead of static_assertEdward O'Callaghan2016-12-072-2/+2
| | | | | | | | Following the spirit of commit 23d1799f, fixes compilation warnings on Android build due to lack of C11 features. Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan/wsi/x11: Destroy Present event context when destroying swapchainMichel Dänzer2016-11-301-0/+6
| | | | | | | | | | | | | | Without this, the X server may accumulate stale Present event contexts if a client creates and destroys multiple swapchains using the same window. v2: Based on Chris Wilson's review: * Use xcb_present_select_input_checked so that protocol errors generated by old X servers can be handled gracefully * Use xcb_discard_reply() instead of free(xcb_request_check()) v3: Rebased on top of this code having been refactored out of anv Reviewed-by: Dave Airlie <[email protected]>
* vulkan/wsi: Fix resource leak in success path of wsi_queue_init()Gwan-gyeong Mun2016-11-281-0/+1
| | | | | | | | | It fixes leakage of pthread_condattr resource on wsi_queue_init() Cc: "13.0" <[email protected]> Signed-off-by: Mun Gwan-gyeong <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHRDave Airlie2016-11-162-10/+22
| | | | | | | | | This fixes the x11 and wayland backends to not assert: dEQP-VK.wsi.xcb.swapchain.get_images.incomplete Reviewed-by: Jason Ekstrand <[email protected]> Cc: "13.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi/x11: Implement FIFO mode.Jason Ekstrand2016-11-101-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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi: Report the correct min/maxImageCountJason Ekstrand2016-11-102-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 <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi: Add a thread-safe queue implementationKevin Strasser2016-11-102-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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/wayland: Clean up some error handling pathsJason Ekstrand2016-11-091-0/+8
| | | | | | | | This gets rid of all the memory leaks reported by the WSI CTS tests. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/wayland: Include pthread.hJason Ekstrand2016-11-091-0/+1
| | | | | | | We use pthreads and, for some reason, it wasn't getting included Signed-off-by: Jason Ekstrand <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/x11: Clean up connections in finish_wsiJason Ekstrand2016-11-021-0/+4
| | | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/x11: Better handle wsi_x11_connection_create failureJason Ekstrand2016-11-021-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 <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/x11: Smplify implementation of vkGetPhysicalDeviceSurfaceFormatsKHREduardo Lima Mitev2016-10-281-8/+3
| | | | | | | | 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 <[email protected]>
* vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHREduardo Lima Mitev2016-10-281-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 <[email protected]>
* vulkan/wsi/x11: add support for IMMEDIATE present modeDave Airlie2016-10-271-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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi: store present mode in swapchain base classDave Airlie2016-10-273-3/+5
| | | | | | | | This just moves this up a level as x11 will need it to implement things properly. Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)Dave Airlie2016-10-271-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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi/wayland: fix ARGB window supportFredrik Höglund2016-10-261-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" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi/x11: fix ARGB window supportFredrik Höglund2016-10-261-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" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHREduardo Lima Mitev2016-10-251-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* wsi/wayland: fix error pathEric Engestrom2016-10-201-0/+4
| | | | | | | Fixes: 1720bbd353d87412754f ("anv/wsi: split image alloc/free out to separate fns.") Cc: "13.0" <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* 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 <[email protected]>