mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 18:50:10 +01:00
pvr: add VK_EXT_physical_device_drm support
This is notably required by Wayland compositors with a Vulkan renderer. This implementation exposes the primary (cardN) node of the render device as its the primary node, as the preferred way of implementing this in Mesa. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Reviewed-by: Simon Perretta <simon.perretta@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25431>
This commit is contained in:
parent
54d8f2a1cf
commit
5120a91c82
3 changed files with 35 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue