mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 05:58:05 +02:00
nvk: Implement the VR-related display extensions
xrgears in Monado direct mode seems to work (I haven't tried running CTS tests though) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27654>
This commit is contained in:
parent
5feb326d80
commit
017818a8bf
5 changed files with 27 additions and 8 deletions
|
|
@ -506,7 +506,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_KHR_calibrated_timestamps DONE (anv, radv)
|
||||
VK_KHR_cooperative_matrix DONE (anv, radv/gfx11+)
|
||||
VK_KHR_deferred_host_operations DONE (anv, hasvk, radv)
|
||||
VK_KHR_display DONE (anv, pvr, radv, tu, v3dv)
|
||||
VK_KHR_display DONE (anv, nvk, pvr, radv, tu, v3dv)
|
||||
VK_KHR_display_swapchain not started
|
||||
VK_KHR_dynamic_rendering_local_read DONE (lvp)
|
||||
VK_KHR_external_fence_fd DONE (anv, hasvk, nvk, pvr, radv, tu, v3dv, vn)
|
||||
|
|
@ -517,7 +517,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_KHR_external_semaphore_win32 DONE (dzn)
|
||||
VK_KHR_fragment_shader_barycentric DONE (nvk/Turing+, radv/gfx10.3+)
|
||||
VK_KHR_fragment_shading_rate DONE (anv/gen11+, radv/gfx10.3+)
|
||||
VK_KHR_get_display_properties2 DONE (anv, pvr, radv, tu, v3dv)
|
||||
VK_KHR_get_display_properties2 DONE (anv, nvk, pvr, radv, tu, v3dv)
|
||||
VK_KHR_get_surface_capabilities2 DONE (anv, lvp, nvk, pvr, radv, tu, v3dv, vn)
|
||||
VK_KHR_global_priority DONE (anv, radv, tu)
|
||||
VK_KHR_incremental_present DONE (anv, hasvk, lvp, radv, tu, v3dv, vn)
|
||||
|
|
@ -572,10 +572,10 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_EXT_descriptor_buffer DONE (lvp, radv, tu)
|
||||
VK_EXT_device_fault DONE (radv)
|
||||
VK_EXT_device_memory_report DONE (vn)
|
||||
VK_EXT_direct_mode_display DONE (anv, lvp, radv, tu, v3dv)
|
||||
VK_EXT_direct_mode_display DONE (anv, lvp, nvk, radv, tu, v3dv)
|
||||
VK_EXT_discard_rectangles DONE (radv)
|
||||
VK_EXT_display_control DONE (anv, hasvk, radv, tu)
|
||||
VK_EXT_display_surface_counter DONE (anv, lvp, radv, tu)
|
||||
VK_EXT_display_surface_counter DONE (anv, lvp, nvk, radv, tu)
|
||||
VK_EXT_dynamic_rendering_unused_attachments DONE (anv, nvk, radv, vn)
|
||||
VK_EXT_extended_dynamic_state3 DONE (anv, lvp, nvk, radv, tu, vn)
|
||||
VK_EXT_external_memory_acquire_unmodified DONE (radv)
|
||||
|
|
@ -634,7 +634,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_GOOGLE_user_type DONE (anv, hasvk, radv)
|
||||
VK_IMG_filter_cubic DONE (tu/a650)
|
||||
VK_NV_compute_shader_derivatives DONE (anv, hasvk, radv)
|
||||
VK_EXT_acquire_drm_display DONE (anv, radv, tu, v3dv)
|
||||
VK_EXT_acquire_drm_display DONE (anv, nvk, radv, tu, v3dv)
|
||||
VK_VALVE_mutable_descriptor_type DONE (anv, hasvk, radv, tu, vn)
|
||||
VK_AMD_buffer_marker DONE (anv, radv, tu)
|
||||
VK_AMD_device_coherent_memory DONE (radv)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ static const struct vk_instance_extension_table instance_extensions = {
|
|||
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
|
||||
.EXT_acquire_xlib_display = true,
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
|
||||
.KHR_display = true,
|
||||
.KHR_get_display_properties2 = true,
|
||||
.EXT_direct_mode_display = true,
|
||||
.EXT_display_surface_counter = true,
|
||||
.EXT_acquire_drm_display = true,
|
||||
#endif
|
||||
#ifndef VK_USE_PLATFORM_WIN32_KHR
|
||||
.EXT_headless_surface = true,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "vulkan/runtime/vk_shader_module.h"
|
||||
#include "vulkan/wsi/wsi_common.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <xf86drm.h>
|
||||
|
|
@ -929,6 +930,7 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
|
|||
{
|
||||
struct nvk_instance *instance = (struct nvk_instance *)_instance;
|
||||
VkResult result;
|
||||
int master_fd = -1;
|
||||
|
||||
if (!(drm_device->available_nodes & (1 << DRM_NODE_RENDER)))
|
||||
return VK_ERROR_INCOMPATIBLE_DRIVER;
|
||||
|
|
@ -1036,6 +1038,10 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
|
|||
properties.drmHasPrimary = true;
|
||||
properties.drmPrimaryMajor = major(st.st_rdev);
|
||||
properties.drmPrimaryMinor = minor(st.st_rdev);
|
||||
|
||||
/* TODO: Test if the FD is usable? */
|
||||
if (instance->vk.enabled_extensions.KHR_display)
|
||||
master_fd = open(drm_device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC);
|
||||
}
|
||||
|
||||
result = vk_physical_device_init(&pdev->vk, &instance->vk,
|
||||
|
|
@ -1044,9 +1050,10 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
|
|||
&properties,
|
||||
&dispatch_table);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_alloc;
|
||||
goto fail_master_fd;
|
||||
|
||||
pdev->render_dev = render_dev;
|
||||
pdev->master_fd = master_fd;
|
||||
pdev->info = info;
|
||||
pdev->debug_flags = debug_flags;
|
||||
|
||||
|
|
@ -1127,7 +1134,9 @@ fail_disk_cache:
|
|||
nak_compiler_destroy(pdev->nak);
|
||||
fail_init:
|
||||
vk_physical_device_finish(&pdev->vk);
|
||||
fail_alloc:
|
||||
fail_master_fd:
|
||||
if (master_fd >= 0)
|
||||
close(master_fd);
|
||||
vk_free(&instance->vk.alloc, pdev);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1141,6 +1150,8 @@ nvk_physical_device_destroy(struct vk_physical_device *vk_pdev)
|
|||
nvk_finish_wsi(pdev);
|
||||
nvk_physical_device_free_disk_cache(pdev);
|
||||
nak_compiler_destroy(pdev->nak);
|
||||
if (pdev->master_fd >= 0)
|
||||
close(pdev->master_fd);
|
||||
vk_physical_device_finish(&pdev->vk);
|
||||
vk_free(&pdev->vk.instance->alloc, pdev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct nvk_physical_device {
|
|||
enum nvk_debug debug_flags;
|
||||
dev_t render_dev;
|
||||
dev_t primary_dev;
|
||||
int master_fd;
|
||||
struct nak_compiler *nak;
|
||||
struct wsi_device wsi_device;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ nvk_init_wsi(struct nvk_physical_device *pdev)
|
|||
result = wsi_device_init(&pdev->wsi_device,
|
||||
nvk_physical_device_to_handle(pdev),
|
||||
nvk_wsi_proc_addr, &pdev->vk.instance->alloc,
|
||||
-1, &nvk_physical_device_instance(pdev)->dri_options, &wsi_options);
|
||||
pdev->master_fd, &nvk_physical_device_instance(pdev)->dri_options, &wsi_options);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue