aboutsummaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi
Commit message (Collapse)AuthorAgeFilesLines
* vulkan: fix build dependency issue with generated filesLionel Landwerlin2019-05-221-2/+2
| | | | | | | | | | | | | On machines with many cores, you can run into that issue : ../mesa-9999/src/vulkan/overlay-layer/overlay.cpp:42:10: fatal error: vk_enum_to_str.h: No such file or directory v2: Move declare_dependency around (Eric) Signed-off-by: Lionel Landwerlin <[email protected]> Reported-by: Jan Ziak Cc: <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* vulkan/wsi: Set X11 minImageCount to 3.Bas Nieuwenhuizen2019-05-191-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | For IMMEDIATE and FIFO, most games work in a pipelined manner where the can produce frames at a rate of 1/MAX(CPU duration, GPU duration), but the render latency is CPU duration + GPU duration. This means that with scanout from pageflipping we need 3 frames to run full speed: 1) CPU rendering work 2) GPU rendering work 3) scanout Once we have a nonblocking acquire that returns a semaphore we can merge 1 and 3. Hence the ideal implementation needs only 2 images, but games cannot tellwe currently do not have an ideal implementation and that hence they need to allocate 3 images. So let us do it for them. This is a tradeoff as it uses more memory than needed for non-fullscreen and non-performance intensive applications. Since this is pretty much a TODO that can use the context I added this as a comment. Acked-by: Jason Ekstrand <[email protected]> Acked-by: Samuel Pitoiset <[email protected]>
* wsi/wayland: document lack of vkAcquireNextImageKHR timeout supportEric Engestrom2019-05-021-0/+10
| | | | Signed-off-by: Eric Engestrom <[email protected]>
* vulkan/wsi/wayland: Respect non-blocking AcquireNextImageDaniel Stone2019-05-021-2/+7
| | | | | | | | | | | | | | | | | If the client has requested that AcquireNextImage not block at all, with a timeout of 0, then don't make any non-blocking calls. This will still potentially block infinitely given a non-infinte timeout, but the fix for that is much more involved. Signed-off-by: Daniel Stone <[email protected]> Cc: [email protected] Cc: Chad Versace <[email protected]> Cc: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108540 Acked-by: Jason Ekstrand <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-291-2/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* vulkan/wsi: don't use DUMB_CLOSE for normal GEM handlesEmil Velikov2019-04-261-2/+2
| | | | | | | | | | | Currently we get normal GEM handles from PrimeFDToHandle, yet we close then with DUMB_CLOSE. Use GEM_CLOSE instead. Fixes: da997ebec92 ("vulkan: Add KHR_display extension using DRM [v10]") Cc: Jason Ekstrand <[email protected]> Cc: Keith Packard <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* vulkan/wsi: check if the display_fd given is masterEmil Velikov2019-04-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | As effectively required by the extension, we need to ensure we're master Currently drivers employ vendor specific solutions, which check if the device behind the fd is capable*, yet none of them do the master check. *In the radv case, if acceleration is available. Instead of duplicating the check in each driver, keep it where it's needed and used. Note this copies libdrm's drmIsMaster() to avoid depending on bleeding edge version of the library. v2: set the fd to -1 if not master (Bas) Fixes: da997ebec92 ("vulkan: Add KHR_display extension using DRM [v10]") Cc: Andres Rodriguez <[email protected]> Cc: Jason Ekstrand <[email protected]> Cc: Keith Packard <[email protected]> Reported-by: Andres Rodriguez <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* vulkan/wsi: Add X11 adaptive sync support based on dri options.Bas Nieuwenhuizen2019-04-234-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | The dri options are optional. When the dri options are not provided the WSI will not use adaptive sync. FWIW I think for xf86-video-amdgpu this still requires an X11 config option, so only people who opt in can get possible regressions from this. So then the remaining question is: why do this in the WSI? It has been suggested in another MR that the application sets this. However, I disagree with that as I don't think we'll ever get a reasonable set of applications setting it. The next questions is whether this can be a layer. It definitely can be as implemented now. However, I think this generally fits well with the function of the WSI. Furthemore, for e.g. the DISPLAY WSI this is much harder to do in a layer. Of course, most of the WSI could almost be a layer, but I think this still fits best in the WSI. Acked-by: Jason Ekstrand <[email protected]>
* wsi: allow to override the present mode with MESA_VK_WSI_PRESENT_MODESamuel Pitoiset2019-04-106-3/+78
| | | | | | | This is common to all Vulkan drivers and all WSI. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* vulkan/wsi: make wl_drm optionalChia-I Wu2019-04-091-19/+32
| | | | | | | | | | | | When wl_drm is missing and the driver supports modifiers, use zwp_linux_dmabuf_v1 for the list of supported formats and for buffer creation. Limit the supported formats to those with modifiers, which are WL_DRM_FORMAT_{ARGB8888,XRGB8888} currently. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: add wsi_wl_display_dmabufChia-I Wu2019-04-091-22/+28
| | | | | | | Add wsi_wl_display_dmabuf for zwp_linux_dmabuf_v1-related states. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: add wsi_wl_display_drmChia-I Wu2019-04-091-14/+18
| | | | | | | | | | Add wsi_wl_display_drm for wl_drm-related states. We will move formats into the struct in a later commit. Remove the unnecessary check for wl_registry_bind failures. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: refactor drm_handle_formatChia-I Wu2019-04-091-53/+75
| | | | | | | | Refactor the swtich statement in drm_handle_format out to wsi_wl_display_add_wl_format. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: create wl_drm wrapper as neededChia-I Wu2019-04-091-7/+20
| | | | | | | | When modifiers are specified, we have to use dmabuf rather than wl_drm. We don't need the wrapper in that case. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* vulkan/wsi: move modifier array into wsi_wl_swapchainChia-I Wu2019-04-091-20/+32
| | | | | | | This avoids repeated checks for each wsi_wl_image. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* anv,radv: Implement VK_KHR_surface_capability_protectedJason Ekstrand2019-03-183-7/+59
| | | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* vulkan: factor out wsi dependenciesLionel Landwerlin2019-03-181-16/+0
| | | | | | | | | | | | | In commit 530927d3f6a303d9 ("vulkan/util: generate instance/device dispatch tables") we started generating instance dispatch tables some of them (like wayland) require external headers. This commit moves the dependencies up one level so that they apply the whole vulkan directory. We use them for both the util & overlay layer. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 530927d3f6a303 ("vulkan/util: generate instance/device dispatch tables") Reviewed-by: Eric Engestrom <[email protected]>
* wsi/x11: use WSI_FROM_HANDLE() instead of pointer castsEric Engestrom2019-03-111-1/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* wsi/wayland: fix pointer casting warning on 32bitEric Engestrom2019-03-111-1/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* wsi/display: s/#if/#ifdef/ to fix -WundefEric Engestrom2019-03-111-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* wsi: deduplicate get_current_time() functions between display and x11Eric Engestrom2019-03-114-24/+18
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* vulkan/util: generate instance/device dispatch tablesLionel Landwerlin2019-03-061-5/+0
| | | | | | | | This will be used by the overlay instead of system installed validation layers helpers. Signed-off-by: Lionel Landwerlin <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* drm-uapi: use local files, not system libdrmEric Engestrom2019-02-145-5/+5
| | | | | | | | | There was an issue recently caused by the system header being included by mistake, so let's just get rid of this include path and always explicitly #include "drm-uapi/FOO.h" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* wsi: query the ICD's max dimensions instead of hard-coding themEric Engestrom2019-02-086-12/+32
| | | | | | | | | 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* wsi/display: add commentEric Engestrom2019-02-021-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Keith Packard <[email protected]>
* wsi: drop unneeded KHR suffixEric Engestrom2019-01-081-15/+15
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* vulkan/wsi: fix s/,/;/ typoEric Engestrom2018-11-281-2/+2
| | | | | | Fixes: 59e58c348e6af16a5f2dd "vulkan/wsi: Only wait on semaphores on the first swapchain" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* wsi/display: fix mem leak when freeing swapchainsEric Engestrom2018-11-281-0/+2
| | | | | | Fixes: da997ebec92942193955 "vulkan: Add KHR_display extension using DRM [v10]" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Keith Packard <[email protected]>
* vulkan: Allow storage images in the WSI.Bas Nieuwenhuizen2018-11-213-0/+3
| | | | | | | | | | | | | | Since apps also have to follow the ImageFormatProperties query, we can disallow formats that don't allow image stores (for AMD that would be SRGB formats). Note that this only affects anything if the app actually decides to use the flag. Had someone ask for this on IRC and at least on the AMD side we can support it. Reviewed-by: Jason Ekstrand <[email protected]>
* wsi/wayland: only finish() a successfully init()ed displayEric Engestrom2018-11-051-1/+2
| | | | | | | Fixes: 43691024982b3ea734ad0 "vulkan/wsi/wayland: Stop caching Wayland displays" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Philipp Zabel <[email protected]>
* wsi/wayland: use proper VkResult typeEric Engestrom2018-11-051-2/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* vulkan/wsi: use the drmGetDevice2() APIEmil Velikov2018-10-301-1/+1
| | | | | | | | | | | | On older kernels, the drmGetDevice() call will wake up all the GPUs on the system, while fetching the PCI revision. Use the 2 version of the API and pass flags == 0, so we don't fetch the device PCI revision, since we don't need that information. Fixes: baa38c144f6 ("vulkan/wsi: Use VK_EXT_pci_bus_info for DRM fd matching") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan/wsi: simplify meson file trackingEric Engestrom2018-10-291-18/+5
| | | | | | | | Meson already automatically tracks included headers, so there's no need to add them everywhere; cleans up the code a bit. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* vulkan: drop always-true paramEric Engestrom2018-10-262-6/+0
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util: use C99 declaration in the for-loop hash_table_foreach() macroEric Engestrom2018-10-251-1/+0
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* vulkan/wsi: Use VK_EXT_pci_bus_info for DRM fd matchingJason Ekstrand2018-10-187-60/+56
| | | | | | | | This lets us avoid passing the DRM fd around all over the place and gets us closer to layer utopia. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* vulkan/wsi: Implement GetPhysicalDevicePresentRectanglesKHRJason Ekstrand2018-10-186-0/+149
| | | | | | | | | | | | | | | | | | This got missed during 1.1 enabling because it was defined as an interaction between device groups and WSI and it wasn't obvious it was in the delta. The idea behind it is that it's supposed to provide a hint to the application in a multi-GPU setup to indicate which regions of the screen are being scanned out by which GPU so a multi-device split-screen rendering application can render each part of the screen on the GPU that will be presenting it and avoid extra bus traffic between GPUs. On a single-GPU setup or one which doesn't support this present mode, we need to do something. We choose to return the window size (or a max-size rect) if the compositor, X server, or crtc is associated with the given physical device and zero rectangles otherwise. Reviewed-by: Lionel Landwerlin <[email protected]>
* vulkan/wsi: Store the instance allocator in wsi_deviceJason Ekstrand2018-10-187-21/+16
| | | | | | | | | | | | We already have wsi_device and we know the instance allocator at wsi_device_init time so there's no need to pass it into the physical device queries. This also fixes a memory allocation domain bug that can occur if CreateSwapchain gets called prior to any queries (not likely) in which case the cached connection gets allocated off the device instead of the instance. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* vulkan: Disable randr lease for libxcb < 1.13Maxime2018-09-271-0/+2
| | | | | | | | | | | Since the Randr lease code was added, compiling against libxcb 1.12 no longer works. CC: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108024 Fixes: 7ab1fffcd2a504024b16e408de329f7a94553ecc Tested-By: Maxime <[email protected]> Fixes: 7ab1fffcd2a504024b16 "vulkan: Add EXT_acquire_xlib_display [v5]"
* vulkan/wsi/display: wsi_display_select_crtc() doesn' need to modify the ↵Eric Engestrom2018-09-241-1/+1
| | | | | | connector Signed-off-by: Eric Engestrom <[email protected]>
* vulkan/wsi/display: check if wsi_swapchain_init() succeededEric Engestrom2018-09-241-0/+4
| | | | | | | Fixes: da997ebec929421939553 "vulkan: Add KHR_display extension using DRM [v10]" Cc: Keith Packard <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv,radv: Implement vkAcquireNextImage2Jason Ekstrand2018-09-216-22/+16
| | | | | | | | This was added as part of 1.1 but it's very hard to track exactly what extension added it. In any case, we should implement it. Cc: [email protected] Reviewed-by: Dave Airlie <[email protected]>
* vk/wsi: avoid reading uninitialised memoryEric Engestrom2018-08-231-2/+2
| | | | | | | | | | | | It will be ignored by x11_swapchain_result() anyway (because reaching the `fail` label without setting `result` means the swapchain status was already a hard error), but the compiler still complains about reading uninitialised memory. While at it, drop the unused assignment right before returning. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* vulkan/wsi: fix pointer-integer conversion warningsGrazvydas Ignotas2018-08-232-3/+3
| | | | | | For 32bit build. Trivial. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* vulkan/wsi: initialise image_index to 0 in x11_manage_fifo_queuesKai Wasserbäch2018-08-181-1/+1
| | | | | | | | | | Supresses a maybe-uninitialized warning with GCC 8. Note: image_index should always be initialised due to the result check, but the compiler doesn't see that. Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* vulkan/wsi: fix incorrect assignment in assert()Eric Engestrom2018-07-251-2/+2
| | | | | | | CovID: 1438113, 1438118, 1438119, 1438121 Fixes: dc1d10b396179766227df "anv,radv: Add support for VK_KHR_get_display_properties2" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv,radv: Add support for VK_KHR_get_display_properties2Jason Ekstrand2018-07-092-16/+186
| | | | Reviewed-by: Keith Packard <[email protected]>
* vulkan/wsi_common_display: Return SURFACE_LOST for fatal DRM errorsKeith Packard2018-06-271-7/+7
| | | | | | | | | | | | | Instead of encouraging the client to re-create the swapchain and keep going with an OUT_OF_DATE error, tell the client that further use of the current surface will not succeed as the associated kernel objects are no longer valid. In particular, when a DRM lease is revoked, then the client needs to get another lease and create a new surface for that. Signed-off-by: Keith Packard <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan: add VK_EXT_display_control [v10]Keith Packard2018-06-233-2/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This extension provides fences and frame count information to direct display contexts. It uses new kernel ioctls to provide 64-bits of vblank sequence and nanosecond resolution. v2: Remove DRM_CRTC_SEQUENCE_FIRST_PIXEL_OUT flag. This has been removed from the proposed kernel API. Add NULL parameter to drmCrtcQueueSequence ioctl as we don't care what sequence the event was actually queued to. v3: Adapt to pthread clock switch to MONOTONIC v4: Fix scope for wsi_display_mode andwsi_display_connector allocs Suggested-by: Jason Ekstrand <[email protected]> v5: Adopt Jason Ekstrand's coding conventions Declare variables at first use, eliminate extra whitespace between types and names. Wrap lines to 80 columns. Use wsi_rel_to_abs_time helper function to convert relative timeouts to absolute timeouts without causing overflow. Suggested-by: Jason Ekstrand <[email protected]> v6: Change WSI fence wait function to return VkResult instead of bool. This makes the meaning of the return value easier to understand, and allows for the indication of failure. Also change the WSI fence wait function to take only absolute timeouts and not provide an option for a relative timeout. No users wanted relative timeouts, and it's simpler if that option isn't available. Terminate the DPMS property loop once we've found the property. Assert that the fence hasn't already been destroyed in wsi_display_fence_destroy. Rearrange the event handler function order in the file to place routines in an easier to find order. Suggested-by: Jason Ekstrand <[email protected]> v7: Adapt to API changes for surface_get_capabilities v8: Use wsi->alloc in register_display_event so that callers don't have to dig out an allocator for us. v9: Fix a few minor formatting issues Suggested-by: Jason Ekstrand <[email protected]> v10: Use wsi->alloc if none provided in wsi_display_fence_alloc. Now that drivers are expected to pass the allocator argument straight through from the application, we need to check those for NULL everywhere. Signed-off-by: Keith Packard <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan: EXT_acquire_xlib_display requires libXrandr headers to buildKeith Packard2018-06-201-1/+1
| | | | | | | | | | | | | | | | | When VK_USE_PLATFORM_XLIB_XRANDR_EXT is defined, vulkan.h includes X11/extensions/Xrandr.h for the RROutput typedef which is used in the vkGetRandROutputDisplayEXT interface. Make sure we have the required header by checking during the build, and also set CFLAGS to point at the right directory. We don't need to link against the library as we don't use any functions from there, so don't add the _LIBS value in the autotools build. Signed-off-by: Keith Packard <[email protected]> Fixes: dbac8e25f851ed44c51f "radv: Add EXT_acquire_xlib_display to radv driver [v2]" Reviewed-by: Eric Engestrom <[email protected]>