diff --git a/docs/features.txt b/docs/features.txt index 535eedc663e..8bda2f7d3c4 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -646,7 +646,7 @@ Khronos extensions that are not part of any Vulkan version: VK_EXT_non_seamless_cube_map DONE (anv, hasvk, hk, lvp, nvk, panvk, radv, tu, vn) VK_EXT_pageable_device_local_memory DONE (lvp) VK_EXT_pci_bus_info DONE (anv, hasvk, nvk, radv, vn) - VK_EXT_physical_device_drm DONE (anv, hasvk, hk, nvk, panvk, radv, tu, v3dv, vn) + VK_EXT_physical_device_drm DONE (anv, hasvk, hk, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_EXT_pipeline_library_group_handles DONE (anv, lvp, radv, vn) VK_EXT_post_depth_coverage DONE (anv/gfx11+, lvp, nvk, radv/gfx10+, tu, vn) VK_EXT_primitive_topology_list_restart DONE (anv, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn, nvk) diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 25a2e499439..488ec0c8335 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -208,6 +209,7 @@ static void pvr_physical_device_get_supported_extensions( .EXT_host_query_reset = true, .EXT_image_2d_view_of_3d = true, .EXT_index_type_uint8 = false, + .EXT_physical_device_drm = true, .EXT_private_data = true, .EXT_provoking_vertex = true, .EXT_queue_family_foreign = true, @@ -633,6 +635,14 @@ static bool pvr_physical_device_get_properties( /* VK_EXT_custom_border_color */ .maxCustomBorderColorSamplers = PVR_BORDER_COLOR_TABLE_NR_CUSTOM_ENTRIES, + + /* VkPhysicalDeviceDrmPropertiesEXT */ + .drmHasPrimary = true, + .drmPrimaryMajor = (int64_t) major(pdevice->primary_devid), + .drmPrimaryMinor = (int64_t) minor(pdevice->primary_devid), + .drmHasRender = true, + .drmRenderMajor = (int64_t) major(pdevice->render_devid), + .drmRenderMinor = (int64_t) minor(pdevice->render_devid), }; if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) { @@ -839,6 +849,8 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, struct vk_properties supported_properties; struct vk_features supported_features; struct pvr_winsys *ws; + struct stat primary_stat = {0}, render_stat = {0}; + char *primary_path; char *display_path; char *render_path; VkResult result; @@ -863,6 +875,23 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, display_path = NULL; } + primary_path = drm_render_device->nodes[DRM_NODE_PRIMARY]; + if (stat(primary_path, &primary_stat) != 0) { + result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, + "failed to stat DRM primary node %s", + primary_path); + goto err_vk_free_display_path; + } + pdevice->primary_devid = primary_stat.st_rdev; + + if (stat(render_path, &render_stat) != 0) { + result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, + "failed to stat DRM render node %s", + render_path); + goto err_vk_free_display_path; + } + pdevice->render_devid = render_stat.st_rdev; + result = pvr_winsys_create(render_path, display_path, &instance->vk.alloc, &ws); if (result != VK_SUCCESS) diff --git a/src/imagination/vulkan/pvr_private.h b/src/imagination/vulkan/pvr_private.h index 0a6f665b5bf..c6aa8aab729 100644 --- a/src/imagination/vulkan/pvr_private.h +++ b/src/imagination/vulkan/pvr_private.h @@ -103,6 +103,11 @@ struct pvr_physical_device { char *render_path; char *display_path; + /* primary node (cardN) of the render device */ + dev_t primary_devid; + /* render node (renderN) of the render device */ + dev_t render_devid; + struct pvr_winsys *ws; struct pvr_device_info dev_info; struct pvr_device_runtime_info dev_runtime_info;